Skip to content

Commit

Permalink
Added option for zmin and zmax
Browse files Browse the repository at this point in the history
  • Loading branch information
HiramHerrera committed Aug 14, 2024
1 parent 8340561 commit 69ecffa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion py/desisim/scripts/gen_qso_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ def main():

parser.add_argument("--exptime", type=float, default=None, required=False,
help='Exposure time to assign to all targets in the mock catalog')

parser.add_argument("--zmin", type=float, default=1.7, required=False,
help='Minimum redshift')

parser.add_argument("--zmax", type=float, default=10.0, required=False,
help='Maximum redshift')

parser.add_argument("--release", type=str, default='jura', choices=['iron','jura','Y5'], required=False,
help='DESI survey release to reproduce')
Expand All @@ -47,7 +53,7 @@ def main():
# Note: For Y1 and Y3 mocks (and probably Y5 too) the target selection redshift distribution
# from Chaussidon et al. 2022 works better to match QSO targets Iron catalog.
# The option distribution='from_data' should be a better option once I finish implementing it.
survey.apply_redshift_dist(distribution='target_selection', zmin=1.8)
survey.apply_redshift_dist(distribution='target_selection', zmin=args.zmin, zmax=args.zmax)

# Apply NPASS geometry either from a release or a custom tiles file.
survey.apply_data_geometry(release=args.release, tilefile=args.tiles_file)
Expand Down
3 changes: 1 addition & 2 deletions py/desisim/survey_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ def assign_exposures(self,exptime=None):
log.warning('Effective exposure time TSNR2_LRG column not found in observed data catalog.')
log.warning('Will compute effective exposure time from alternative templates.')
if 'TSNR2_LYA' in self.data.colnames:
log.warning('TSNR2_LRG column not found in observed data catalog.')
log.info('Getting effective exposure time in data catalog by 11.8*TSNR2_LYA.')
exptime_data = 11.8*self.data['TSNR2_LYA']
elif 'TSNR2_QSO' in self.data.colnames:
Expand Down Expand Up @@ -418,7 +417,7 @@ def get_catalog_dndzdm(cat,zbins=np.linspace(0,10,100+1), rmagbins=np.linspace(1
return dn_dzdm, zbins, rmagbins

def generate_random_fluxes(dist, z, zcenters, rmagcenters,invert=False):
cdf=np.sum(dist,axis=1)
cdf=np.cumsum(dist,axis=1)
cdf = np.divide(cdf,cdf[:,-1][:,None],where=cdf[:,-1][:,None]>0,out=np.zeros_like(cdf))
dz = zcenters[1]-zcenters[0]
mags=np.zeros(len(z))
Expand Down

0 comments on commit 69ecffa

Please sign in to comment.