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

Implement capping of catalog MAXMAG to 11.2 mag #301

Merged
merged 1 commit into from
Jun 11, 2019
Merged
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
2 changes: 1 addition & 1 deletion proseco/acq.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def calc_p_brightest(self, acq, box_size, man_err=0, bgd=0):
# Imposters
ext_box_size = box_size + dither
kwargs = dict(star_row=acq['row'], star_col=acq['col'],
maxmag=acq['mag'] + acq['mag_err'], # + 1.5, TO DO: put to characteristics
maxmag=acq['mag'] + acq['mag_err'],
box_size=ext_box_size,
dark=dark,
bgd=bgd, # TO DO deal with this
Expand Down
4 changes: 2 additions & 2 deletions proseco/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def merge_cats(fids=None, guides=None, acqs=None):
if len(guides) > 0:
guides['slot'] = 0 # Filled in later
guides['type'] = 'GUI'
guides['maxmag'] = guides['mag'] + 1.5
guides['maxmag'] = (guides['mag'] + 1.5).clip(None, ACA.max_maxmag)
guides['p_acq'] = 0
guides['dim'] = 1
guides['res'] = 1
Expand All @@ -434,7 +434,7 @@ def merge_cats(fids=None, guides=None, acqs=None):

if len(acqs) > 0:
acqs['type'] = 'ACQ'
acqs['maxmag'] = acqs['mag'] + 1.5
acqs['maxmag'] = (acqs['mag'] + 1.5).clip(None, ACA.max_maxmag)
acqs['dim'] = 20
acqs['sz'] = guide_size
acqs['res'] = 1
Expand Down
4 changes: 4 additions & 0 deletions proseco/characteristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
PIX_2_ARC = 4.96289
ARC_2_PIX = 1.0 / PIX_2_ARC

# Maximum value of star catalog MAXMAG parameter. Clip value and implications
# of clipping discussed in emails circa June 7, 2019 with search key "maxmag".
max_maxmag = 11.2

# Convenience characteristics
max_ccd_row = CCD['row_max'] - CCD['row_pad'] # Max allowed row for stars (SOURCE?)
max_ccd_col = CCD['col_max'] - CCD['col_pad'] # Max allow col for stars (SOURCE?)
Expand Down
26 changes: 26 additions & 0 deletions proseco/tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,32 @@ def test_copy_deepcopy_pickle():
assert val is not val2


def test_clip_maxmag():
"""Test that clipping maxmag for guide and acq stars works
"""
stars = StarsTable.empty()
mag0 = ACA.max_maxmag - 1.5 # nominal star mag when clipping occurs (11.2 - 1.5 = 9.7)
mags_acq = np.array([-1.5, -1, -0.5, -0.01, 0.01, 0.2, 0.3, 0.4]) + mag0
mags_guide = np.array([-0.5, -0.01, 0.01, 0.2, 0.3]) + mag0
stars.add_fake_constellation(mag=mags_acq, n_stars=8, size=2000)
stars.add_fake_constellation(mag=mags_guide, n_stars=5, size=1000)
aca = get_aca_catalog(stars=stars, dark=DARK40, raise_exc=True,
exclude_ids_guide=np.arange(100, 108),
exclude_ids_acq=np.arange(108, 113),
**STD_INFO)

assert np.all(aca['maxmag'] <= ACA.max_maxmag)

ok = aca['type'] == 'FID'
assert np.allclose(aca['maxmag'][ok], 8.0)

ok = aca['type'] == 'GUI'
assert np.allclose(aca['maxmag'][ok], (mags_guide + 1.5).clip(None, ACA.max_maxmag))

ok = aca['type'] == 'ACQ'
assert np.allclose(aca['maxmag'][ok], (mags_acq + 1.5).clip(None, ACA.max_maxmag))


def test_big_sim_offset():
"""
Check getting a catalog for a large SIM offset that means there are
Expand Down