From 5a1a7794fe18f44621246df7f5e5c277342cb5c7 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Wed, 30 Jan 2019 01:59:32 -0500 Subject: [PATCH 1/7] Remove really bright stars from early stages --- proseco/characteristics_guide.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proseco/characteristics_guide.py b/proseco/characteristics_guide.py index df38cda3..c19d6821 100644 --- a/proseco/characteristics_guide.py +++ b/proseco/characteristics_guide.py @@ -41,7 +41,7 @@ stages = [{"Stage": 1, "SigErrMultiplier": 3, "ASPQ1Lim": 0, - "MagLimit": [5.9, 10.2], + "MagLimit": [6.2, 10.2], "DoBminusVcheck": 1, "Spoiler": { "BgPixThresh": 25, @@ -53,7 +53,7 @@ {"Stage": 2, "SigErrMultiplier": 2, "ASPQ1Lim": 0, - "MagLimit": [5.9, 10.2], + "MagLimit": [6.2, 10.2], "DoBminusVcheck": 1, "Spoiler": { "BgPixThresh": 25, @@ -65,7 +65,7 @@ {"Stage": 3, "SigErrMultiplier": 1, "ASPQ1Lim": 10, - "MagLimit": [5.9, 10.3], + "MagLimit": [6.1, 10.3], "DoBminusVcheck": 1, "Spoiler": { "BgPixThresh": 25, @@ -77,7 +77,7 @@ {"Stage": 4, "SigErrMultiplier": 0, "ASPQ1Lim": 20, - "MagLimit": [5.9, 10.3], + "MagLimit": [6.0, 10.3], "DoBminusVcheck": 1, "Spoiler": { "BgPixThresh": 25, From c51a360c8294650a6e5f76c3f7044ce92657d8c0 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Fri, 8 Feb 2019 08:22:35 -0500 Subject: [PATCH 2/7] Add more margin to the code for bright star selection In the "select stars for this stage by mag" code, these changes 1). Set a lower bound of 0.1 mags on the effective mag error of stars brighter than 7.0 mag 2). Set a lower bound of 1 on the multiplier used with the effective mag error. 3). Explicitly exclude stars that are within 2 sigma of 5.8 --- proseco/guide.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/proseco/guide.py b/proseco/guide.py index b4705362..fc3f1db8 100644 --- a/proseco/guide.py +++ b/proseco/guide.py @@ -234,11 +234,26 @@ def search_stage(self, stage): n_sigma = stage['SigErrMultiplier'] + # For the reasonable mag check, override the SigErrMultiplier to be at least 1. + # It may go to 0 in later stages for the spoiler checks. + mag_err_mult = max(n_sigma, 1) + + # And for bright stars, use a local mag_err that is lower bounded at 0.1 + # for the mag selection. + mag_err = cand_guides['mag_err'] + bright = cand_guides['mag'] < 7.0 + mag_err[bright] = mag_err[bright].clip(0.1) + # Check reasonable mag bright_lim = stage['MagLimit'][0] faint_lim = stage['MagLimit'][1] - bad_mag = (((cand_guides['mag'] - n_sigma * cand_guides['mag_err']) < bright_lim) | - ((cand_guides['mag'] + n_sigma * cand_guides['mag_err']) > faint_lim)) + # Confirm that the star mag is not outside the limits when padded by error + # and explicitly confirm that the star is not within 2 * mag_err of the hard + # bright limit. + bad_mag = ( + ((cand_guides['mag'] - mag_err_mult * mag_err) < bright_lim) | + ((cand_guides['mag'] + mag_err_mult * mag_err) > faint_lim) | + ((cand_guides['mag'] - 2 * mag_err) < 5.8)) for idx in np.flatnonzero(bad_mag): self.reject({'id': cand_guides['id'][idx], 'type': 'mag outside range', @@ -246,7 +261,7 @@ def search_stage(self, stage): 'bright_lim': bright_lim, 'faint_lim': faint_lim, 'cand_mag': cand_guides['mag'][idx], - 'cand_mag_err_times_sigma': n_sigma * cand_guides['mag_err'][idx], + 'cand_mag_err_times_sigma': mag_err_mult * mag_err[idx], 'text': f'Cand {cand_guides["id"][idx]} rejected with mag outside range for stage'}) cand_guides[scol][bad_mag] += GUIDE.errs['mag range'] ok = ok & ~bad_mag From dad9fc9edbe91534597c21d0fcedc1d7d404c84a Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Fri, 8 Feb 2019 10:24:33 -0500 Subject: [PATCH 3/7] Set lower bound on mag_err to 0.5 for color1=0.7 stars in bounds check --- proseco/guide.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proseco/guide.py b/proseco/guide.py index fc3f1db8..78e3cad1 100644 --- a/proseco/guide.py +++ b/proseco/guide.py @@ -243,6 +243,9 @@ def search_stage(self, stage): mag_err = cand_guides['mag_err'] bright = cand_guides['mag'] < 7.0 mag_err[bright] = mag_err[bright].clip(0.1) + # Also set any color=0.7 stars to have lower bound mag err of 0.5 + bad_color = np.isclose(cand_guides['COLOR1'], 0.7) + mag_err[bad_color] = mag_err[bad_color].clip(0.5) # Check reasonable mag bright_lim = stage['MagLimit'][0] From c60218b008d4d29f04302bc1cb6f5e3fce399873 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Fri, 8 Feb 2019 10:29:48 -0500 Subject: [PATCH 4/7] Fix long line --- proseco/guide.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proseco/guide.py b/proseco/guide.py index 78e3cad1..23e37405 100644 --- a/proseco/guide.py +++ b/proseco/guide.py @@ -265,7 +265,8 @@ def search_stage(self, stage): 'faint_lim': faint_lim, 'cand_mag': cand_guides['mag'][idx], 'cand_mag_err_times_sigma': mag_err_mult * mag_err[idx], - 'text': f'Cand {cand_guides["id"][idx]} rejected with mag outside range for stage'}) + 'text': (f'Cand {cand_guides["id"][idx]} rejected with ' + 'mag outside range for stage')}) cand_guides[scol][bad_mag] += GUIDE.errs['mag range'] ok = ok & ~bad_mag From 9b51491b4a0f2f80afdff5417630ca563c4f6cf6 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Fri, 8 Feb 2019 10:44:07 -0500 Subject: [PATCH 5/7] Leave the faint end alone for now --- proseco/guide.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/proseco/guide.py b/proseco/guide.py index 23e37405..1f3e2c0e 100644 --- a/proseco/guide.py +++ b/proseco/guide.py @@ -234,10 +234,6 @@ def search_stage(self, stage): n_sigma = stage['SigErrMultiplier'] - # For the reasonable mag check, override the SigErrMultiplier to be at least 1. - # It may go to 0 in later stages for the spoiler checks. - mag_err_mult = max(n_sigma, 1) - # And for bright stars, use a local mag_err that is lower bounded at 0.1 # for the mag selection. mag_err = cand_guides['mag_err'] @@ -250,12 +246,14 @@ def search_stage(self, stage): # Check reasonable mag bright_lim = stage['MagLimit'][0] faint_lim = stage['MagLimit'][1] - # Confirm that the star mag is not outside the limits when padded by error - # and explicitly confirm that the star is not within 2 * mag_err of the hard + # Confirm that the star mag is not outside the limits when padded by error. + # For the bright end of the check, set a lower bound to always use at least 1 + # mag_err, but do not bother with this bound at the faint end of the check. + # Also explicitly confirm that the star is not within 2 * mag_err of the hard # bright limit. bad_mag = ( - ((cand_guides['mag'] - mag_err_mult * mag_err) < bright_lim) | - ((cand_guides['mag'] + mag_err_mult * mag_err) > faint_lim) | + ((cand_guides['mag'] - max(n_sigma, 1) * mag_err) < bright_lim) | + ((cand_guides['mag'] + n_sigma * mag_err) > faint_lim) | ((cand_guides['mag'] - 2 * mag_err) < 5.8)) for idx in np.flatnonzero(bad_mag): self.reject({'id': cand_guides['id'][idx], @@ -264,7 +262,7 @@ def search_stage(self, stage): 'bright_lim': bright_lim, 'faint_lim': faint_lim, 'cand_mag': cand_guides['mag'][idx], - 'cand_mag_err_times_sigma': mag_err_mult * mag_err[idx], + 'cand_mag_err_times_sigma': n_sigma * mag_err[idx], 'text': (f'Cand {cand_guides["id"][idx]} rejected with ' 'mag outside range for stage')}) cand_guides[scol][bad_mag] += GUIDE.errs['mag range'] From f578d44aae5f1c0c08b603fdee396deca6ad44de Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Sat, 16 Feb 2019 20:31:50 -0500 Subject: [PATCH 6/7] Add a 6th stage to bring in guide stars as bright as 5.8 mag --- proseco/characteristics_guide.py | 13 +++++++++++++ proseco/guide.py | 7 ++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/proseco/characteristics_guide.py b/proseco/characteristics_guide.py index c19d6821..663605f9 100644 --- a/proseco/characteristics_guide.py +++ b/proseco/characteristics_guide.py @@ -97,11 +97,24 @@ }, "Imposter": { "CentroidOffsetLim": 4.5, + }}, + {"Stage": 6, + "SigErrMultiplier": 0, + "ASPQ1Lim": 20, + "MagLimit": [5.6, 10.3], + "DoBminusVcheck": 0, + "Spoiler": { + "BgPixThresh": 25, + "RegionFrac": .05, + }, + "Imposter": { + "CentroidOffsetLim": 4.0, }, } ] + # Guide cluster checks. # Index is the "n_minus" value, so n - 0 stars need minimum 2500 max separation # n - 1 stars require 1000 arcsec separation. diff --git a/proseco/guide.py b/proseco/guide.py index 1f3e2c0e..15f371c7 100644 --- a/proseco/guide.py +++ b/proseco/guide.py @@ -250,11 +250,12 @@ def search_stage(self, stage): # For the bright end of the check, set a lower bound to always use at least 1 # mag_err, but do not bother with this bound at the faint end of the check. # Also explicitly confirm that the star is not within 2 * mag_err of the hard - # bright limit. + # bright limit (which is basically 5.8, but if bright lim set to less than 5.8 + # in the stage, take that). bad_mag = ( ((cand_guides['mag'] - max(n_sigma, 1) * mag_err) < bright_lim) | ((cand_guides['mag'] + n_sigma * mag_err) > faint_lim) | - ((cand_guides['mag'] - 2 * mag_err) < 5.8)) + ((cand_guides['mag'] - 2 * mag_err) < min(bright_lim, 5.8))) for idx in np.flatnonzero(bad_mag): self.reject({'id': cand_guides['id'][idx], 'type': 'mag outside range', @@ -366,7 +367,7 @@ def get_candidates_mask(self, stars): """ ok = ((stars['CLASS'] == 0) & - (stars['mag'] > 5.9) & + (stars['mag'] > 5.8) & (stars['mag'] < 10.3) & (stars['mag_err'] < 1.0) & # Mag err < 1.0 mag (stars['ASPQ1'] < 20) & # Less than 1 arcsec offset from nearby spoiler From 1f2196ba6c5be7d127355cee0952d4615f5e50a2 Mon Sep 17 00:00:00 2001 From: Jean Connelly Date: Sat, 16 Feb 2019 20:33:06 -0500 Subject: [PATCH 7/7] Reduce offset thresholds in stages 4 and 5 --- proseco/characteristics_guide.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proseco/characteristics_guide.py b/proseco/characteristics_guide.py index 663605f9..5cbb8217 100644 --- a/proseco/characteristics_guide.py +++ b/proseco/characteristics_guide.py @@ -84,7 +84,7 @@ "RegionFrac": .05, }, "Imposter": { - "CentroidOffsetLim": 2.5, + "CentroidOffsetLim": 2.0, }}, {"Stage": 5, "SigErrMultiplier": 0, @@ -96,7 +96,7 @@ "RegionFrac": .05, }, "Imposter": { - "CentroidOffsetLim": 4.5, + "CentroidOffsetLim": 3.5, }}, {"Stage": 6, "SigErrMultiplier": 0,