Skip to content

Commit

Permalink
Make U-iso and Pu-iso reference line energies match SandiaDecay - so …
Browse files Browse the repository at this point in the history
…this way auto-peak search will properly assign nuclides to these peaks.
  • Loading branch information
wcjohns committed Oct 5, 2024
1 parent 788c1a8 commit c741a1c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 26 deletions.
3 changes: 3 additions & 0 deletions InterSpec_resources/app_text/InterSpec.xml
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@
<message id="pct-bilinear-step">Bi-linear Step</message>
<message id="pct-global">Global Cont.</message>

<!-- populateNuclideSelects() in PeakSearchGuiUtils.cpp -->
<message id="psd-no-source">No Source</message>


<message id="window-content-hard-back-sub">
<div style="text-align: left;">
Expand Down
38 changes: 19 additions & 19 deletions data/add_ref_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,49 +67,49 @@
The Description element is not currently used within InterSpec, but may be in the future.
-->
<Description>Recommended default uranium peaks to try and fit, when you are doing an isotopic analysis using the "Isotopics from peaks" tool.</Description>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">238.625 1.0</Line>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">583.187 1.0</Line>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">727.3 1.0</Line>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">860.56 1.0</Line>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">238.632 1.0</Line>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">583.191 1.0</Line>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">727.33 1.0</Line>
<Line nuc="U232" color="rgb(14,196,69)" atten="false">860.564 1.0</Line>

<Line nuc="U234" color="rgb(176,7,170)" atten="false">120.905 1.0</Line>
<Line nuc="U234" color="rgb(176,7,170)" atten="false">120.9 1.0</Line>

<Line nuc="U235" color="rgb(224,63,13)" atten="false">143.76 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">163.36 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">185.715 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">163.38 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">185.71 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">202.11 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">205.311 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">221.38 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">205.309 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">221.4 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">246.84 1.0</Line>
<Line nuc="U235" color="rgb(224,63,13)" atten="false">345.9 1.0</Line>

<Line nuc="U238" color="rgb(5,22,99)" atten="false">258.26 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">569.317 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">742.83 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">766.4 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">880.47 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">569.5 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">742.77 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">766.37 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">880.5 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">883.24 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">945.95 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">1001.03 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">945.9 1.0</Line>
<Line nuc="U238" color="rgb(5,22,99)" atten="false">1000.99 1.0</Line>
</SourceLines>

<SourceLines name="Pu-iso">
<Description>Recommended default plutonium peaks to try and fit, when you are doing an isotopic analysis using the "Isotopics from peaks" tool.</Description>
<Line nuc="Pu238" color="#384b83" atten="false">152.72 1.0</Line>

<Line nuc="Pu239" color="#ff7605" atten="false">129.3 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">144.2 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">129.296 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">144.201 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">161.45 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">203.55 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">255.38 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">345.01 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">375.05 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">413.71 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">451.48 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">645.9 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">645.896 1.0</Line>
<Line nuc="Pu239" color="#ff7605" atten="false">658.86 1.0</Line>

<Line nuc="Pu240" color="#384b83" atten="false">160.31 1.0</Line>
<Line nuc="Pu240" color="#384b83" atten="false">160.308 1.0</Line>

<Line nuc="Pu241" color="#f74758" atten="false">146.55 1.0</Line>
<Line nuc="Pu241" color="#f74758" atten="false">164.61 1.0</Line>
Expand Down
21 changes: 14 additions & 7 deletions src/PeakSearchGuiUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ class PeakSelectorWindow : public AuxWindow
continue;

m_nuc_select_combos[i]->clear();
m_nuc_select_combos[i]->addItem( "No Source" );
m_nuc_select_combos[i]->addItem( WString::tr("psd-no-source") );

shared_ptr<PeakDef> &p = m_old_to_new_peaks[i].second;
if( !p )
Expand Down Expand Up @@ -1536,10 +1536,10 @@ class PeakSelectorWindow : public AuxWindow
case ReferenceLineInfo::SourceType::Reaction:
case ReferenceLineInfo::SourceType::Background:
case ReferenceLineInfo::SourceType::NuclideMixture:
case ReferenceLineInfo::SourceType::OneOffSrcLines:
break;

case ReferenceLineInfo::SourceType::CustomEnergy:
case ReferenceLineInfo::SourceType::OneOffSrcLines:
case ReferenceLineInfo::SourceType::None:
continue;
break;
Expand Down Expand Up @@ -1576,7 +1576,11 @@ class PeakSelectorWindow : public AuxWindow
const double diff_from_mean = fabs( refenergy - peakmean );
const double diff_from_assigned = fabs( refenergy - energy );

if( (diff_from_assigned < 0.001)
// If we are assigning from a nuclide, we should be pretty close, but if OneOffSrcLines,
// we might be off by even a
const double allowed_diff = (ref->m_source_type == ReferenceLineInfo::SourceType::OneOffSrcLines) ? 0.05 : 0.001;

if( (diff_from_assigned < allowed_diff) //May need to decrease
&& ((p->parentNuclide() && (line.m_parent_nuclide==p->parentNuclide()))
|| (p->xrayElement() && (line.m_element==p->xrayElement()))
|| (p->reaction() && (line.m_reaction ==p->reaction()))
Expand Down Expand Up @@ -2494,7 +2498,7 @@ void automated_search_for_peaks( InterSpec *viewer,
if( refLineDisp )
{
const ReferenceLineInfo &currentNuclide = refLineDisp->currentlyShowingNuclide();
displayed = refLineDisp->persistedNuclides();
displayed = refLineDisp->persistedNuclides(); //refLineDisp->showingNuclides()

if( currentNuclide.m_validity == ReferenceLineInfo::InputValidity::Valid )
displayed.insert( displayed.begin(), currentNuclide );
Expand Down Expand Up @@ -2818,9 +2822,12 @@ void assign_srcs_from_ref_lines( const std::shared_ptr<const SpecUtils::Measurem
}//if( addswap )


//ToDo: use std::lower_bound to insert
answerpeaks->push_back( peak );
std::sort( begin(*answerpeaks), end(*answerpeaks), peak_less_than_by_energy );
auto sorted_pos = std::lower_bound( begin(*answerpeaks), end(*answerpeaks), peak, peak_less_than_by_energy );
answerpeaks->insert( sorted_pos, peak );

assert( std::is_sorted( begin(*answerpeaks), end(*answerpeaks), peak_less_than_by_energy ) );
//answerpeaks->push_back( peak );
//std::sort( begin(*answerpeaks), end(*answerpeaks), peak_less_than_by_energy );
}//for( PeakDef peak : unassignedpeaks )

resultpeaks->clear();
Expand Down

0 comments on commit c741a1c

Please sign in to comment.