Skip to content

Commit

Permalink
Fix query for fields (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdstein authored Aug 17, 2023
1 parent d7d03dc commit 547743b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ def test_get_fields_in_box(self):

fields = get_fields_in_box(ra_lim, dec_lim, summer=True)

assert len(fields) == 17, "Wrong number of fields"
assert fields["ID"].iloc[0] == 55286, "Wrong field"
assert len(fields) == 28, f"Wrong number of fields ({len(fields)})"
assert fields["ID"].iloc[0] == 54494, f"Wrong field {fields['ID'].iloc[0]}"

fields = get_fields_in_box(ra_lim, dec_lim, summer=False)

assert len(fields) == 2, "Wrong number of fields"
assert fields["ID"].iloc[0] == 3735, "Wrong field"
assert len(fields) == 3, f"Wrong number of fields ({len(fields)})"
assert fields["ID"].iloc[0] == 3735, f"Wrong field {fields['ID'].iloc[0]}"

def test_get_field_info(self):
"""
Expand Down
5 changes: 3 additions & 2 deletions wintertoo/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ def get_fields_in_box(
"""

field_df = get_fields(summer=summer)
base_width = 0.5 * get_base_width(summer=summer)

res = field_df.query(
f"(RA > {ra_lim[0]}) and (RA < {ra_lim[1]}) "
f"and (Dec > {dec_lim[0]}) and (Dec < {dec_lim[1]})"
f"(RA > {ra_lim[0] - base_width}) and (RA < {ra_lim[1] + base_width}) "
f"and (Dec > {dec_lim[0] - base_width}) and (Dec < {dec_lim[1] + base_width})"
)
return res

Expand Down

0 comments on commit 547743b

Please sign in to comment.