Skip to content

Commit

Permalink
Require targname (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdstein authored May 20, 2024
1 parent 4efc43e commit 55e8f24
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "wintertoo"
version = "1.6.0"
version = "1.6.1"
description = ""
authors = [
{name = "Robert Stein", email = "[email protected]"},
Expand Down
10 changes: 9 additions & 1 deletion tests/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_generate_schedule(self):
dec_deg=11.253441,
start_time_mjd=62721.1894969287,
end_time_mjd=62722.1894969452,
target_name="test_radec",
),
program=program,
)
Expand All @@ -81,6 +82,7 @@ def test_generate_schedule(self):
dec_deg=11.253441,
total_exposure_time=100.0,
n_dither=1,
target_name="test_radec",
),
program=program,
)
Expand All @@ -100,6 +102,7 @@ def test_schedule_utils(self):

field_too = SummerFieldToO(
field_id=1,
target_name="test_field",
)

schedule_field(
Expand All @@ -109,6 +112,11 @@ def test_schedule_utils(self):
)

concat_toos(
[field_too, SummerRaDecToO(ra_deg=173.7056754, dec_deg=11.253441)],
[
field_too,
SummerRaDecToO(
ra_deg=173.7056754, dec_deg=11.253441, target_name="test_radec"
),
],
program=program,
)
2 changes: 1 addition & 1 deletion tests/testdata/test_schedule.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"targName":{"0":null,"1":null,"2":null,"3":null},"raDeg":{"0":173.7056754,"1":173.7056754,"2":173.7056754,"3":173.7056754},"decDeg":{"0":11.253441,"1":11.253441,"2":11.253441,"3":11.253441},"fieldID":{"0":999999999,"1":999999999,"2":999999999,"3":999999999},"filter":{"0":"u","1":"g","2":"r","3":"i"},"visitExpTime":{"0":960.0,"1":960.0,"2":960.0,"3":960.0},"singleExpTime":{"0":120.0,"1":120.0,"2":120.0,"3":120.0},"priority":{"0":50.0,"1":50.0,"2":50.0,"3":50.0},"progPI":{"0":"Stein","1":"Stein","2":"Stein","3":"Stein"},"progName":{"0":"2021A000","1":"2021A000","2":"2021A000","3":"2021A000"},"progID":{"0":1,"1":1,"2":1,"3":1},"validStart":{"0":62721.1894969287,"1":62721.1894969287,"2":62721.1894969287,"3":62721.1894969287},"validStop":{"0":62722.1894969452,"1":62722.1894969452,"2":62722.1894969452,"3":62722.1894969452},"observed":{"0":false,"1":false,"2":false,"3":false},"maxAirmass":{"0":2.0,"1":2.0,"2":2.0,"3":2.0},"ditherNumber":{"0":8,"1":8,"2":8,"3":8},"ditherStepSize":{"0":90.0,"1":90.0,"2":90.0,"3":90.0},"bestDetector":{"0":true,"1":true,"2":true,"3":true},"obsHistID":{"0":0,"1":1,"2":2,"3":3}}
{"targName":{"0":"test_radec","1":"test_radec","2":"test_radec","3":"test_radec"},"raDeg":{"0":173.7056754,"1":173.7056754,"2":173.7056754,"3":173.7056754},"decDeg":{"0":11.253441,"1":11.253441,"2":11.253441,"3":11.253441},"fieldID":{"0":999999999,"1":999999999,"2":999999999,"3":999999999},"filter":{"0":"u","1":"g","2":"r","3":"i"},"visitExpTime":{"0":960.0,"1":960.0,"2":960.0,"3":960.0},"singleExpTime":{"0":120.0,"1":120.0,"2":120.0,"3":120.0},"priority":{"0":50.0,"1":50.0,"2":50.0,"3":50.0},"progPI":{"0":"Stein","1":"Stein","2":"Stein","3":"Stein"},"progName":{"0":"2021A000","1":"2021A000","2":"2021A000","3":"2021A000"},"progID":{"0":1,"1":1,"2":1,"3":1},"validStart":{"0":62721.1894969287,"1":62721.1894969287,"2":62721.1894969287,"3":62721.1894969287},"validStop":{"0":62722.1894969452,"1":62722.1894969452,"2":62722.1894969452,"3":62722.1894969452},"observed":{"0":false,"1":false,"2":false,"3":false},"maxAirmass":{"0":2.0,"1":2.0,"2":2.0,"3":2.0},"ditherNumber":{"0":8,"1":8,"2":8,"3":8},"ditherStepSize":{"0":90.0,"1":90.0,"2":90.0,"3":90.0},"bestDetector":{"0":true,"1":true,"2":true,"3":true},"obsHistID":{"0":0,"1":1,"2":2,"3":3}}
2 changes: 1 addition & 1 deletion wintertoo/data/observing_request_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"ditherNumber": {"type": "integer", "default": 8},
"ditherStepSize": {"type": "number", "comment": "arcsec", "default": 90.0},
"fieldID": {"type": "integer", "default": 999999999},
"targName": {"type": ["string", "null"], "comment": "Target name e.g. GW170817", "default": null},
"targName": {"type": ["string"], "comment": "Target name e.g. GW170817"},
"bestDetector": {"type": "boolean", "comment": "Center Ra/Dec of target on best detector", "default": true}
},
"required": [
Expand Down
3 changes: 1 addition & 2 deletions wintertoo/models/too.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ class ToORequest(BaseModel):
title="Priority for target",
ge=0.0,
)
target_name: Optional[str] = Field(
target_name: str = Field(
title="Name of the target",
min_length=1,
max_length=MAX_TARGNAME_LEN,
examples=["SN2021abc", "ZTF19aapreis"],
default=get_default_value("targName"),
)
total_exposure_time: float = Field(
default=get_default_value("visitExpTime"),
Expand Down

0 comments on commit 55e8f24

Please sign in to comment.