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

Enforce exposure start and duration results from cutouts are float #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions cutouts/io/nsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def find_cutouts_nsc_dr2(
_get_generic_image_url_from_cutout_url
)

# enforce exposure_start_mjd and exptime as float
results["exposure_start_mjd"] = results["exposure_start_mjd"].astype(float)
results["exposure_duration"] = results["exposure_duration"].astype(float)

results["exposure_id"] = results["cutout_url"].apply(exposure_id_from_url)
results.reset_index(inplace=True, drop=True)

Expand Down
28 changes: 14 additions & 14 deletions cutouts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,12 @@ def run_cutouts_from_precovery(
"vdec": observations["pred_vdec_degpday"].values[i],
"obj_ra": observations["ra_deg"].values[i],
"obj_dec": observations["dec_deg"].values[i],
"mag": np.NaN,
"mag_sigma": np.NaN,
"mag": np.nan,
"mag_sigma": np.nan,
"filter": None,
"obscode": observations["obscode"].values[i],
"exposure_start": np.NaN,
"exposure_duration": np.NaN,
"exposure_start": np.nan,
"exposure_duration": np.nan,
"exposure_id": None,
}
else:
Expand Down Expand Up @@ -332,25 +332,25 @@ def run_cutouts_from_precovery(
"path": None,
"ra": observations["pred_ra_deg"].values[i],
"dec": observations["pred_dec_deg"].values[i],
"vra": np.NaN,
"vdec": np.NaN,
"mag": np.NaN,
"mag_sigma": np.NaN,
"vra": np.nan,
"vdec": np.nan,
"mag": np.nan,
"mag_sigma": np.nan,
"filter": None,
"obscode": observations["obscode"].values[i],
"exposure_start": np.NaN,
"exposure_duration": np.NaN,
"exposure_start": np.nan,
"exposure_duration": np.nan,
"exposure_id": None,
}
else:
candidate = {
"path": comparison_result["cutout_image_path"],
"ra": observations["pred_ra_deg"].values[i],
"dec": observations["pred_dec_deg"].values[i],
"vra": np.NaN,
"vdec": np.NaN,
"mag": np.NaN,
"mag_sigma": np.NaN,
"vra": np.nan,
"vdec": np.nan,
"mag": np.nan,
"mag_sigma": np.nan,
"filter": comparison_result["filter"],
"obscode": observations["obscode"].values[i],
"exposure_start": comparison_result["exposure_start_mjd"],
Expand Down
10 changes: 5 additions & 5 deletions cutouts/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ def test_add_velocity_vector_raises():

fig, ax = plt.subplots(1, 1)
with pytest.raises(ValueError):
add_velocity_vector(ax, np.NaN, 0, 0, 0, 0)
add_velocity_vector(ax, np.nan, 0, 0, 0, 0)

with pytest.raises(ValueError):
add_velocity_vector(ax, 0, np.NaN, 0, 0, 0)
add_velocity_vector(ax, 0, np.nan, 0, 0, 0)

with pytest.raises(ValueError):
add_velocity_vector(ax, 0, 0, np.NaN, 0, 0)
add_velocity_vector(ax, 0, 0, np.nan, 0, 0)

with pytest.raises(ValueError):
add_velocity_vector(ax, 0, 0, 0, np.NaN, 0)
add_velocity_vector(ax, 0, 0, 0, np.nan, 0)

with pytest.raises(ValueError):
add_velocity_vector(ax, 0, 0, 0, 0, np.NaN)
add_velocity_vector(ax, 0, 0, 0, 0, np.nan)
Loading