Skip to content

Commit

Permalink
Add Observatory presets
Browse files Browse the repository at this point in the history
  • Loading branch information
moeyensj committed Sep 19, 2024
1 parent c492e1b commit c0517ec
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 18 deletions.
22 changes: 4 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,17 @@ P9 = load_P9(P9_DIR)
Loading in a pointing table for a survey or telescope. Here we create one for NSC DR2:

```python
from adam_test_data.observatory import Observatory, Simulation, FieldOfView
from adam_test_data.observatories.presets import load_W84
from adam_test_data.pointings import Pointings

w84 = load_W84()

w84 = Observatory(
code="W84",
filters=["u", "g", "r", "i", "z", "Y", "VR"],
main_filter="r",
bright_limit=[15.0,15.0,15.0,15.0,15.0,15.0,15.0],
fov=FieldOfView(
camera_model="circle",
circle_radius=1.1,
fill_factor=0.9
),
simulation=Simulation(
ang_fov=2.5,
fov_buffer=0.1
)
)


# Load in the NSC DR2 exposures (this is external data not included in the package)
nsc_dr2_exposures = pd.read_csv("nsc_dr2_exposure.csv")
nsc_dr2_exposures["depth5sig"] = nsc_dr2_exposures["depth95"]
nsc_dr2_exposures_w84 = nsc_dr2_exposures[nsc_dr2_exposures["instrument"] == "c4d"]

# Create a Pointings object using the exposures info
w84_pointings = Pointings.from_kwargs(
observationId=nsc_dr2_exposures_w84["exposure"],
observationStartMJD_TAI=Time(nsc_dr2_exposures_w84["mjd"], format="mjd", scale="utc").tai.mjd,
Expand Down
21 changes: 21 additions & 0 deletions src/adam_test_data/observatories/presets/695.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"code": "695",
"filters": [
"g",
"r"
],
"main_filter": "r",
"bright_limit": [
15.0,
15.0
],
"fov": {
"camera_model": "circle",
"circle_radius": 1.5,
"fill_factor": 0.9
},
"simulation": {
"ang_fov": 2.0,
"fov_buffer": 0.2
}
}
20 changes: 20 additions & 0 deletions src/adam_test_data/observatories/presets/V00.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"code": "V00",
"filters": [
"z"
],
"main_filter": "z",
"bright_limit": [
15.0

],
"fov": {
"camera_model": "circle",
"circle_radius": 0.875,
"fill_factor": 0.9
},
"simulation": {
"ang_fov": 1,
"fov_buffer": 0.2
}
}
31 changes: 31 additions & 0 deletions src/adam_test_data/observatories/presets/W84.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"code": "W84",
"filters": [
"u",
"g",
"r",
"i",
"z",
"Y",
"VR"
],
"main_filter": "r",
"bright_limit": [
15.0,
15.0,
15.0,
15.0,
15.0,
15.0,
15.0
],
"fov": {
"camera_model": "circle",
"circle_radius": 1.1,
"fill_factor": 0.9
},
"simulation": {
"ang_fov": 2.0,
"fov_buffer": 0.2
}
}
29 changes: 29 additions & 0 deletions src/adam_test_data/observatories/presets/X05.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"code": "X05",
"filters": [
"u",
"g",
"r",
"i",
"z",
"y"
],
"main_filter": "r",
"bright_limit": [
16.0,
16.0,
16.0,
16.0,
16.0,
16.0
],
"fov": {
"camera_model": "circle",
"circle_radius": 1.75,
"fill_factor": 0.9
},
"simulation": {
"ang_fov": 2.06,
"fov_buffer": 0.2
}
}
2 changes: 2 additions & 0 deletions src/adam_test_data/observatories/presets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ruff: noqa: F401
from .load import load_695, load_V00, load_W84, load_X05
84 changes: 84 additions & 0 deletions src/adam_test_data/observatories/presets/load.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from importlib.resources import files
from typing import Optional

from ..observatory import Observatory


def load_W84(file: Optional[str] = None) -> Observatory:
"""
Load CTIO's DECam on the 4m Blanco telescope from a JSON file.
Parameters
----------
file : str, optional
The path to the JSON file.
Returns
-------
Observatory
The observatory object.
"""
if file is None:
file = str(files("adam_test_data").joinpath("observatories", "presets", "W84.json"))

return Observatory.from_json(file)


def load_695(file: Optional[str] = None) -> Observatory:
"""
Load the Mayall 4m telescope from a JSON file.
Parameters
----------
file : str, optional
The path to the JSON file.
Returns
-------
Observatory
The observatory object.
"""
if file is None:
file = str(files("adam_test_data").joinpath("observatories", "presets", "695.json"))

return Observatory.from_json(file)


def load_V00(file: Optional[str] = None) -> Observatory:
"""
Load the Bok 2.3m telescope from a JSON file.
Parameters
----------
file : str, optional
The path to the JSON file.
Returns
-------
Observatory
The observatory object.
"""
if file is None:
file = str(files("adam_test_data").joinpath("observatories", "presets", "V00.json"))

return Observatory.from_json(file)


def load_X05(file: Optional[str] = None) -> Observatory:
"""
Load the Rubin Observatory observatory from a JSON file.
Parameters
----------
file : str, optional
The path to the JSON file.
Returns
-------
Observatory
The observatory object.
"""
if file is None:
file = str(files("adam_test_data").joinpath("observatories", "presets", "X05.json"))

return Observatory.from_json(file)

0 comments on commit c0517ec

Please sign in to comment.