@@ -534,6 +534,18 @@ bool read_fluxes(const options_t& opts, input_state_t& state) {
534534 if (col_zspec == npos) {
535535 // If no zspec column, give no zspec to all galaxies
536536 state.zspec = replicate (fnan, state.id .size ());
537+ } else {
538+ // Check that zspecs are covered by the redshift grid
539+ if (min (state.zspec ) < opts.z_min ) {
540+ error (" the smallest z_spec is outside of the grid " , min (state.zspec ),
541+ " vs. " , opts.z_min , " )" );
542+ return false ;
543+ }
544+ if (max (state.zspec ) > opts.z_max ) {
545+ error (" the largest z_spec is outside of the grid " , max (state.zspec ),
546+ " vs. " , opts.z_max , " )" );
547+ return false ;
548+ }
537549 }
538550
539551 // Convert photometry from [catalog unit] to [uJy]
@@ -1014,6 +1026,30 @@ bool read_photoz(const options_t& opts, input_state_t& state) {
10141026 return false ;
10151027 }
10161028
1029+ // Check that zspecs are covered by the redshift grid
1030+ if (min (state.zspec ) < opts.z_min ) {
1031+ error (" the smallest z_spec is outside of the grid " , min (state.zspec ),
1032+ " vs. " , opts.z_min , " )" );
1033+ return false ;
1034+ }
1035+ if (max (state.zspec ) > opts.z_max ) {
1036+ error (" the largest z_spec is outside of the grid " , max (state.zspec ),
1037+ " vs. " , opts.z_max , " )" );
1038+ return false ;
1039+ }
1040+
1041+ // Check that zphots are covered by the redshift grid
1042+ if (min (state.zphot (_,0 )) < opts.z_min ) {
1043+ error (" the smallest z_phot is outside of the grid " , min (state.zphot (_,0 )),
1044+ " vs. " , opts.z_min , " )" );
1045+ return false ;
1046+ }
1047+ if (max (state.zphot (_,0 )) > opts.z_max ) {
1048+ error (" the largest z_phot is outside of the grid " , max (state.zphot (_,0 )),
1049+ " vs. " , opts.z_max , " )" );
1050+ return false ;
1051+ }
1052+
10171053 return true ;
10181054}
10191055
0 commit comments