Skip to content

Commit

Permalink
5.4.4 Edits to wording around the NIE green bars
Browse files Browse the repository at this point in the history
Signed-off-by: boban <bob.anderson.ok@gmail.com>
  • Loading branch information
bob-anderson-ok committed Oct 7, 2023
1 parent 1f78336 commit 562c998
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 20 deletions.
Binary file modified src/pyoteapp/pyote-info.pdf
Binary file not shown.
38 changes: 27 additions & 11 deletions src/pyoteapp/pyote.py
Original file line number Diff line number Diff line change
Expand Up @@ -7462,7 +7462,7 @@ def finalReportPenumbral(self):
f'{self.observedDrop:0.1f} three sigma drop from noise: {self.threeSigmaLine:0.1f} margin: {margin:0.1f}'
self.showMsg(stats_msg, blankLine=False, bold=True, color='red')

stats_msg = f'fit metrics === observed drop has probability {self.drop_nie_probability:0.6e} of being a noise-induced-event'
stats_msg = f'fit metrics === observed drop has {self.reportDropProbability()} of being a noise-induced-event'
self.showMsg(stats_msg, blankLine=False, bold=True)

stats_msg = f'fit metrics === {self.magDropReportStr}'
Expand Down Expand Up @@ -7554,7 +7554,7 @@ def finalReport(self, error_bar_plots_available=True):
# self.showMsg(f"This 'drop' has a zero probability of being an artifact of noise.",
# bold=True, color='green', blankLine=False)

self.showMsg(f'The observed drop has a probability of {self.drop_nie_probability:0.6e} of being a noise-induced-event',
self.showMsg(f'The observed drop has {self.reportDropProbability()} of being a noise-induced-event',
bold=True, color='blue', blankLine=True)

# self.showMsg(f">>>> probability > 0.0000 indicates the 'drop' may be spurious (a noise artifact)."
Expand Down Expand Up @@ -7640,7 +7640,8 @@ def finalReport(self, error_bar_plots_available=True):
f'{self.observedDrop:0.1f} three sigma drop from noise: {self.threeSigmaLine:0.1f} margin: {margin:0.1f}'
self.showMsg(stats_msg, blankLine=False, bold=True, color='red')

stats_msg = f'fit metrics === observed drop has probability {self.drop_nie_probability:0.6e} of being a noise-induced-event'

stats_msg = f'fit metrics === observed drop has {self.reportDropProbability()} of being a noise-induced-event'
self.showMsg(stats_msg, blankLine=False, bold=True)

stats_msg = f'fit metrics === {self.magDropReportStr}'
Expand Down Expand Up @@ -7675,7 +7676,7 @@ def finalReport(self, error_bar_plots_available=True):
self.updateFitMetricTxtFile()

if error_bar_plots_available:
self.showHelp(self.helpLabelForFalsePositive)
self.showHelp(self.helpLabelForFalsePositive) # Hidden label on SqWave model tab

def addSourceFileToFitMetricTxtFile(self):
lightCurveDir = os.path.dirname(self.csvFilePath) # This gets the folder where the light-curve.csv is located
Expand Down Expand Up @@ -8081,7 +8082,8 @@ def computeErrorBars(self, plots_wanted=True):
# self.fiveSigmaLine = self.doFalsePositiveReport(posCoefs, plots_wanted=False) # noqa

fp_plot, false_positive, false_probability, self.observedDrop, self.threeSigmaLine, \
self.fourSigmaLine, fiveSigmaLine = self.doFalsePositiveReport(posCoefs) # noqa
self.fourSigmaLine, self.fiveSigmaLine = self.doFalsePositiveReport(posCoefs) # noqa


if plots_wanted:
self.errBarWin = pg.GraphicsWindow(
Expand Down Expand Up @@ -8228,6 +8230,22 @@ def computeErrorBars(self, plots_wanted=True):

self.newRedrawMainPlot() # To add envelope to solution

def reportDropProbability(self):
# TODO Remove these print statements
# print(f'3 sigma drop: {self.threeSigmaLine:0.3f}')
# print(f'4 sigma drop: {self.fourSigmaLine:0.3f}')
# print(f'5 sigma drop: {self.fiveSigmaLine:0.3f}')
# print(f'observed drop: {self.observedDrop:0.3f}')

# Expected usage: observed drop has <one of strings below> of being induced by noise
if self.observedDrop < self.threeSigmaLine:
return f'a less than 3 sigma probability level'
elif self.observedDrop < self.fiveSigmaLine:
return f'a probability of {self.drop_nie_probability:0.1e}'
else:
self.dropSigmaEstimate = (self.observedDrop - self.fiveSigmaLine) / (self.fiveSigmaLine - self.fourSigmaLine)
return f'an estimated {self.dropSigmaEstimate:0.1f} sigma level'

def calcDetectability(self):
if self.timeDelta == 0:
self.showInfo(f'Cannot use the detectibilty tool on a light curve without timestamps.')
Expand Down Expand Up @@ -8572,11 +8590,11 @@ def falsePositiveReport(self, event_duration, num_trials, observation_size, obse

three_sigma_estimate = sorted_drops[int(.997 * drops.size)]

self.showInfo(f'Calculating the noise-induced-drop probability - this can take many seconds!\n\n'
f'Be patient if/while the hourglass is showing.')
# self.showInfo(f'Calculating the noise-induced-drop probability - this can take many seconds!\n\n'
# f'Be patient if/while the hourglass is showing.')

self.showMsg(f'Calculating the noise-induced-drop probability - this can take many seconds! '
f'Be patient if/while the hourglass is showing.', color='red', bold=True)
f'Be patient.', color='red', bold=True)
QtGui.QGuiApplication.processEvents()

two_sigma_line, three_sigma_line, four_sigma_line, five_sigma_line, self.drop_nie_probability = \
Expand All @@ -8596,9 +8614,7 @@ def falsePositiveReport(self, event_duration, num_trials, observation_size, obse
title=f'Noise Induced Events (brightness drops) found in correlated noise for event duration: {event_duration}',
labels={'bottom': 'brightness drop', 'left': 'number of times noise produced drop'})
pw.hideButtons()
# y, x = np.histogram(drops, bins='auto')

# y[0] = y[1] / 2.0
# Plot drops histogram
pw.plot(bins, counts, stepMode=True, fillLevel=0, brush=(0, 0, 255, 150))

Expand All @@ -8622,7 +8638,7 @@ def falsePositiveReport(self, event_duration, num_trials, observation_size, obse

pw.addLegend()
pw.plot(name=f'red line: the observed drop (B - A) extracted from lightcurve has '
f'probability {self.drop_nie_probability:0.6e} of being noise induced')
f'a probability {self.drop_nie_probability:0.1e} of being noise induced')
pw.plot(name=f'black curve is LSQ fit to drop data using the Gumbel Extreme Value distribution')
pw.plot(name=f'green lines are at 3 sigma (99.7%), 4 sigma (99.9938%), and 5 sigma (99.99994%)')
# pw.plot(name=f'PyOTE reports a "pass" if red line is to the right of the three_sigma_line,')
Expand Down
16 changes: 8 additions & 8 deletions src/pyoteapp/pyote.ui
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
<property name="movable">
<bool>true</bool>
</property>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="Lightcurves">
<attribute name="title">
<string>Lightcurves</string>
</attribute>
Expand Down Expand Up @@ -2574,7 +2574,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="analysisTab">
<widget class="QWidget" name="SqWaveModel">
<attribute name="title">
<string>SqWave model</string>
</attribute>
Expand Down Expand Up @@ -2781,7 +2781,7 @@
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;Advisory =========== for Noise Induced Event (NIE) distribution&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Assuming that you have been diligent in removing common lightcurve artifacts (dips caused by something other than an occultation,  like clouds, or a contrail, or ...) using the normalization function (when appropriate), please be aware that ...&lt;/p&gt;&lt;p&gt;... finding the &lt;span style=&quot; color:#ff0000;&quot;&gt;red&lt;/span&gt; bar (positioned at the observed brightness drop value) to the left of the &lt;span style=&quot; color:#00aa00;&quot;&gt;green&lt;/span&gt; bar (this &lt;span style=&quot; font-weight:700; color:#0000ff;&quot;&gt;three_sigma_line&lt;/span&gt; shows where 99.7% of brightness drops due to noise are located) is usually sufficient reason to report a 'miss' (but see note below).&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt; But&lt;/span&gt;, before reporting a 'miss', you should use the Event Detectability calculator to determine if the event was 'detectable'. If the event was 'detectable' and yet a 'miss', the observation has value in constraining one edge of the asteroid. If the 'miss' was of an 'undetectable' event, its value as a constraint on the asteroid edge is greatly diminished.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;However&lt;/span&gt;,  a &lt;span style=&quot; color:#ff0000;&quot;&gt;red&lt;/span&gt; bar to the right of the black bar should &lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;NEVER&lt;/span&gt; be the sole reason to report a 'positive'.&lt;/p&gt;&lt;p&gt;If you get a red bar to the right of the black bar, &lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;and this is the only available chord&lt;/span&gt;, look at the Noise Induced Event distribution plot and only consider reporting a 'positive' if the measured brightness drop is well to the right of the black bar (which shows the biggest brightness drop found during the simulation run). 'Well to the right' is rather vague, so consult with your area coordinator whenever you are uncertain.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;Note:&lt;/span&gt; if your observed 'brightness drop' (&lt;span style=&quot; color:#ff0000;&quot;&gt;red&lt;/span&gt; bar) is to the right of the &lt;span style=&quot; color:#00aa7f;&quot;&gt;green&lt;/span&gt; bar AND there are nearby chords reporting 'positives', there may be value in your observation in spite of a non-zero NIE probability calculation result; your observation may increase confidence in the event recorded by the nearby chords.&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;Advisory =========== for Noise Induced Event (NIE) distribution&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Assuming that you have been diligent in removing common lightcurve artifacts (dips caused by something other than an occultation,  like clouds, or a contrail, or ...) using the normalization function (when appropriate), please be aware that ...&lt;/p&gt;&lt;p&gt;... finding the &lt;span style=&quot; color:#ff0000;&quot;&gt;red&lt;/span&gt; bar (positioned at the observed brightness drop value) to the left of the three &lt;span style=&quot; color:#00aa00;&quot;&gt;green&lt;/span&gt; bars (the leftmost bar is the &lt;span style=&quot; font-weight:700; color:#0000ff;&quot;&gt;three_sigma_line&lt;/span&gt; and shows where 99.7% of brightness drops due to noise are located) is usually sufficient reason to report a 'miss' (but see &lt;span style=&quot; font-weight:700; color:#ff0000;&quot;&gt;Note&lt;/span&gt; below).&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt; But&lt;/span&gt;, before reporting a 'miss', you should use the Event Detectability calculator to determine if the event was 'detectable'. If the event was 'detectable' and yet a 'miss', the observation has value in constraining one edge of the asteroid. If the 'miss' was of an 'undetectable' event, its value as a constraint on the asteroid edge is greatly diminished.&lt;/p&gt;&lt;p&gt;(The green bars are at the 3 sigma, 4 sigma, and 5 sigma positions. Any event with a drop that is greater than 5 sigma has a vanishingly small probability of being induced by noise alone.)&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;However&lt;/span&gt;,  a &lt;span style=&quot; color:#ff0000;&quot;&gt;red&lt;/span&gt; bar to the right of the three green bars should &lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;NEVER&lt;/span&gt; be the sole reason to report a 'positive'.&lt;/p&gt;&lt;p&gt;If you get a red bar to the right of all the green bars, &lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;and this is the only available chord&lt;/span&gt;,  consult with your area coordinator as to whether the observation can be reported as a positive.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600; color:#fc0107;&quot;&gt;Note:&lt;/span&gt; if your observed 'brightness drop' (&lt;span style=&quot; color:#ff0000;&quot;&gt;red&lt;/span&gt; bar) is to the right of at least the first &lt;span style=&quot; color:#00aa7f;&quot;&gt;green&lt;/span&gt; bar but not to the right of the last green bar AND there are nearby chords reporting 'positives', there may be value in your observation in spite of the drop falling in the three sigma to five sigma probability 'gray zone'; your observation may increase confidence in the event recorded by the nearby chords.&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
Expand Down Expand Up @@ -3312,7 +3312,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<widget class="QWidget" name="VizierExport">
<attribute name="title">
<string>VizieR export</string>
</attribute>
Expand Down Expand Up @@ -4846,7 +4846,7 @@
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="OtherModels">
<attribute name="title">
<string>Other models</string>
</attribute>
Expand Down Expand Up @@ -6543,7 +6543,7 @@ Setting this value to zero will force Miss distance optimization to be skipped.<
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_9">
<widget class="QWidget" name="ManualTimestamps">
<attribute name="title">
<string>Manual timestamps</string>
</attribute>
Expand Down Expand Up @@ -7087,7 +7087,7 @@ Setting this value to zero will force Miss distance optimization to be skipped.<
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_8">
<widget class="QWidget" name="NoiseDetectability">
<attribute name="title">
<string>Noise analysis/Detectability</string>
</attribute>
Expand Down Expand Up @@ -7452,7 +7452,7 @@ Setting this value to zero will force Miss distance optimization to be skipped.<
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="NightEagle3">
<attribute name="title">
<string>Night Eagle 3</string>
</attribute>
Expand Down
2 changes: 1 addition & 1 deletion src/pyoteapp/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def version():
return '5.4.3'
return '5.4.4'

0 comments on commit 562c998

Please sign in to comment.