Skip to content

Commit

Permalink
switch for old ddf coords
Browse files Browse the repository at this point in the history
  • Loading branch information
yoachim committed Jul 18, 2024
1 parent eaed822 commit 0dff4f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 14 additions & 2 deletions rubin_sim/maf/batches/ddf_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

import healpy as hp
import numpy as np
from rubin_scheduler.utils import angular_separation, ddf_locations, hpid2_ra_dec, sample_patch_on_sphere
from rubin_scheduler.utils import (
angular_separation,
ddf_locations,
ddf_locations_pre3_5,
hpid2_ra_dec,
sample_patch_on_sphere,
)

import rubin_sim.maf as maf

Expand All @@ -16,6 +22,7 @@ def ddfBatch(
nside_sne=128,
extra_sql=None,
extra_info_label=None,
old_coords=False,
):
"""
A set of metrics to evaluate DDF fields.
Expand All @@ -42,6 +49,8 @@ def ddfBatch(
necessary sql constraints for each metric.
extra_info_label : `str`, optional
Additional description information to add (alongside the extra_sql)
old_coords : `bool`
Use the default locations for the DDFs from pre-July 2024. Default False.
Returns
-------
Expand All @@ -53,7 +62,10 @@ def ddfBatch(
# Define the slicer to use for each DDF
# Get standard DDF locations and reformat information as a dictionary
ddfs = {}
ddfs_rough = ddf_locations()
if old_coords:
ddfs_rough = ddf_locations_pre3_5()
else:
ddfs_rough = ddf_locations()
for ddf in ddfs_rough:
ddfs[ddf] = {"ra": ddfs_rough[ddf][0], "dec": ddfs_rough[ddf][1]}
# Combine the Euclid double-field into one - but with two ra/dec values
Expand Down
5 changes: 4 additions & 1 deletion rubin_sim/maf/ddf_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def ddf_dir():
parser = argparse.ArgumentParser()
parser.add_argument("--db", type=str, default=None)
parser.add_argument("--nside", type=int, default=512)
parser.add_argument("--old_coords", dest="old_coords", action="store_true")
parser.set_defaults(verbose=False)

args = parser.parse_args()

if args.db is None:
Expand All @@ -35,7 +38,7 @@ def ddf_dir():
shutil.rmtree(name + "_ddf")

bdict = {}
bdict.update(batches.ddfBatch(run_name=name, nside=args.nside))
bdict.update(batches.ddfBatch(run_name=name, nside=args.nside, old_coords=args.old_coords))
results_db = db.ResultsDb(out_dir=name + "_ddf")
group = mb.MetricBundleGroup(
bdict,
Expand Down

0 comments on commit 0dff4f4

Please sign in to comment.