Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch for old ddf coords #415

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading