@@ -534,6 +534,18 @@ bool read_fluxes(const options_t& opts, input_state_t& state) {
534
534
if (col_zspec == npos) {
535
535
// If no zspec column, give no zspec to all galaxies
536
536
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
+ }
537
549
}
538
550
539
551
// Convert photometry from [catalog unit] to [uJy]
@@ -1014,6 +1026,30 @@ bool read_photoz(const options_t& opts, input_state_t& state) {
1014
1026
return false ;
1015
1027
}
1016
1028
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
+
1017
1053
return true ;
1018
1054
}
1019
1055
0 commit comments