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

Add 3 pixels to the guide star selection edge padding #244

Merged
merged 4 commits into from
Feb 7, 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
1 change: 1 addition & 0 deletions proseco/characteristics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'window_pad': 7,
'row_pad': 8,
'col_pad': 1,
'guide_extra_pad': 3,
'bgpix': ['A1', 'B1', 'G1', 'H1', 'I4', 'J4', 'O4', 'P4']}

PIX_2_ARC = 4.96289
Expand Down
19 changes: 9 additions & 10 deletions proseco/guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,25 +317,24 @@ def get_initial_guide_candidates(self):
stars = self.stars
dark = self.dark

# Use the primary selection filter from acq, but allow bad color
# and limit to brighter stars
ok = (self.get_candidates_mask(stars) &
(np.abs(stars['row']) < ACA.max_ccd_row) & # Max usable row
(np.abs(stars['col']) < ACA.max_ccd_col) # Max usable col
)

# Mark stars that are off chip
offchip = (np.abs(stars['row']) > CCD['row_max']) | (np.abs(stars['col']) > CCD['col_max'])
stars['offchip'] = offchip

# Add a filter for stars that are too close to the chip edge including dither
r_dith_pad = self.dither.row
c_dith_pad = self.dither.col
row_max = CCD['row_max'] - (CCD['row_pad'] + CCD['window_pad'] + r_dith_pad)
col_max = CCD['col_max'] - (CCD['col_pad'] + CCD['window_pad'] + c_dith_pad)
row_max = (CCD['row_max'] -
jeanconn marked this conversation as resolved.
Show resolved Hide resolved
(CCD['row_pad'] + CCD['window_pad'] + CCD['guide_extra_pad'] + r_dith_pad))
col_max = (CCD['col_max'] -
(CCD['col_pad'] + CCD['window_pad'] + CCD['guide_extra_pad'] + c_dith_pad))
outofbounds = (np.abs(stars['row']) > row_max) | (np.abs(stars['col']) > col_max)

cand_guides = stars[ok & ~outofbounds]
# Set the candidates to be the set of stars that is both *not* out of bounds
# and satisfies the rules in 'get_candidates_mask' (which uses the primary
# selection filter from acq, but allows bad color and limits to brighter stars).
ok = self.get_candidates_mask(stars) & ~outofbounds
cand_guides = stars[ok]
self.log('Filtering on CLASS, mag, row/col, '
'mag_err, ASPQ1/2, POS_ERR:')
self.log(f'Reduced star list from {len(stars)} to '
Expand Down
7 changes: 4 additions & 3 deletions proseco/tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ def test_get_aca_catalog_20603():
' 2 3 40112304 BOT 6x6 -1644.35 2032.47 20 1 80',
' 3 4 40114416 BOT 6x6 394.22 1204.43 20 1 140',
' 4 5 116791824 BOT 6x6 622.00 -953.60 20 1 160',
' 5 6 116923528 BOT 6x6 -2418.65 1088.40 20 1 160',
' 6 7 40113544 GUI 6x6 102.74 1133.37 1 1 25',
' 6 8 116923496 ACQ 6x6 -1337.79 1049.27 20 1 120',
' 5 6 40113544 GUI 6x6 102.74 1133.37 1 1 25',
' 5 7 116923496 ACQ 6x6 -1337.79 1049.27 20 1 120',
' 6 8 116923528 ACQ 6x6 -2418.65 1088.40 20 1 160',
' 7 9 116791744 ACQ 6x6 985.38 -1210.19 20 1 140',
' 0 10 40108048 ACQ 6x6 2.21 1619.17 20 1 140']


repr(aca) # Apply default formats
assert aca[TEST_COLS].pformat(max_width=-1) == exp

Expand Down
23 changes: 21 additions & 2 deletions proseco/tests/test_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,10 @@ def test_edge_star(dither):
# Add stars exactly at 4 corners of allowed "in bounds" area for this dither
row_dither = dither[0] / 5.
col_dither = dither[1] / 5.
row_max = CCD['row_max'] - (CCD['row_pad'] + CCD['window_pad'] + row_dither)
col_max = CCD['col_max'] - (CCD['col_pad'] + CCD['window_pad'] + col_dither)
row_max = CCD['row_max'] - (CCD['row_pad'] + CCD['window_pad'] + CCD['guide_extra_pad'] +
row_dither)
col_max = CCD['col_max'] - (CCD['col_pad'] + CCD['window_pad'] + CCD['guide_extra_pad'] +
col_dither)
stars.add_fake_star(row=row_max, col=col_max, mag=6.0)
stars.add_fake_star(row=row_max * -1, col=col_max, mag=6.0)
stars.add_fake_star(row=row_max * -1, col=col_max * -1, mag=6.0)
Expand All @@ -505,6 +507,23 @@ def test_edge_star(dither):
# Confirm 4 generic stars plus four corner stars are selected
assert len(guides) == 8

# Do the same as above, but this time don't include the guide edge pad, so
# the edge stars will be off the edge
stars1 = StarsTable.empty()
stars1.add_fake_constellation(mag=[7.0, 7.1, 7.2, 7.3],
id=[1, 2, 3, 4],
size=2000, n_stars=4)
row_max = CCD['row_max'] - (CCD['row_pad'] + CCD['window_pad'] + row_dither)
col_max = CCD['col_max'] - (CCD['col_pad'] + CCD['window_pad'] + col_dither)
stars1.add_fake_star(row=row_max, col=col_max, mag=6.0)
stars1.add_fake_star(row=row_max * -1, col=col_max, mag=6.0)
stars1.add_fake_star(row=row_max * -1, col=col_max * -1, mag=6.0)
stars1.add_fake_star(row=row_max, col=col_max * -1, mag=6.0)
info = mod_std_info(n_guide=8, dither_guide=(row_dither * 5, col_dither * 5), stars=stars1)
guides = get_guide_catalog(**info)
# Confirm 4 generic stars are the only stars that can be used (edge stars are off the edges)
assert len(guides) == 4


def test_get_ax_range():
"""
Expand Down