Skip to content

Commit 17044ae

Browse files
committed
Merge branch 'master' of github.com:sandialabs/InterSpec
2 parents 63d71e8 + 292395c commit 17044ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2057
-422
lines changed

CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ set(sources
347347
src/RefSpectraWidget.cpp
348348
src/RefSpectraModel.cpp
349349
src/SimpleActivityCalc.cpp
350-
src/RefLineKinetic.cpp
350+
src/RefLineDynamic.cpp
351351
js/SpectrumChart.js
352352
js/InterSpec.js
353353
)
@@ -460,7 +460,7 @@ set(headers
460460
InterSpec/RefSpectraWidget.h
461461
InterSpec/RefSpectraModel.h
462462
InterSpec/SimpleActivityCalc.h
463-
InterSpec/RefLineKinetic.h
463+
InterSpec/RefLineDynamic.h
464464
)
465465

466466
if(USE_DB_TO_STORE_SPECTRA)
@@ -861,6 +861,8 @@ if( BUILD_AS_LOCAL_SERVER AND (CMAKE_GENERATOR STREQUAL "Xcode") )
861861
XCODE_SCHEME_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
862862
)
863863
endif( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.17.0" )
864+
865+
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO") #macOS 26 requires this, or else we get some error for development
864866
endif( BUILD_AS_LOCAL_SERVER AND (CMAKE_GENERATOR STREQUAL "Xcode") )
865867

866868
if(MSVC AND (NOT hasParent))

InterSpec/AddNewPeakDialog.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class AddNewPeakDialog : public AuxWindow
6565
static const float m_maxfwhm;// = 450.0f; //reasonable range of peak widths
6666

6767
protected:
68-
/** Flags for what to do in `render(flags)` funciton */
68+
/** Flags for what to do in `render(flags)` function */
6969
enum RenderActions
7070
{
7171
UpdatePreview = 0x01,
@@ -93,12 +93,15 @@ class AddNewPeakDialog : public AuxWindow
9393
Wt::WCheckBox *m_fitEnergy;
9494
Wt::WCheckBox *m_fitFWHM;
9595
Wt::WCheckBox *m_fitAmplitude;
96+
Wt::WCheckBox *m_associateWithNuclide;
97+
98+
const std::string m_initial_src_hint;
9699

97100
Wt::WText *m_chart;
98101

99102
public:
100103

101-
AddNewPeakDialog( const float initialEnergy );
104+
AddNewPeakDialog( const float initialEnergy, const std::string &ref_line_hint );
102105

103106
/** Estimates the peak FWHM to initially use for an energy.
104107
@@ -115,20 +118,22 @@ class AddNewPeakDialog : public AuxWindow
115118
virtual void render( Wt::WFlags<Wt::RenderFlag> flags );
116119

117120
void updateCandidatePeakPreview();
121+
void updateAssociateWithCb();
118122

119123
void roiTypeChanged();
120124

121125
void meanChanged();
122126

123-
124127
void fwhmChanged();
125-
126-
128+
127129
void ampChanged();
128130

129-
130131
void roiRangeChanged();
131132

133+
void associateWithSrcChanged();
134+
135+
void setRefLineSrcToPeak();
136+
132137
void doFit();
133138
};//class AddNewPeakDialog : public AuxWindow
134139

InterSpec/ColorTheme.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ struct ColorTheme
5656
*/
5757
static const char * const sm_color_theme_json_version; //Currently "1"
5858

59-
/** Default color for kinetic reference lines when no specific color is assigned. */
60-
static const char * const sm_kinetic_ref_line_default_color; //"orange"
59+
/** Default colors for dynamic reference lines by category. */
60+
static const char * const sm_dynamic_ref_line_medical_color;
61+
static const char * const sm_dynamic_ref_line_industrial_color;
62+
static const char * const sm_dynamic_ref_line_norm_color;
63+
static const char * const sm_dynamic_ref_line_snm_color;
64+
static const char * const sm_dynamic_ref_line_common_color;
65+
static const char * const sm_dynamic_ref_line_other_color;
6166

6267
/** A listing of the predifeined color themes.
6368
Note that a userPreference for "ColorThemeIndex" that has a negative value
@@ -239,11 +244,13 @@ struct ColorTheme
239244
*/
240245
std::map<std::string,Wt::WColor> referenceLineColorForSources;
241246

242-
/** The color of the "Kinetic" reference lines, if the source isnt assigned a specific
243-
color, either in this ColorTheme, or if it is an "always" source, a specific color assigned
244-
`kinetic_ref_lines.xml`.
245-
*/
246-
Wt::WColor kineticRefLineDefaultColor;
247+
/** Dynamic reference line colors for specific categories. */
248+
Wt::WColor dynamicRefLineMedicalColor;
249+
Wt::WColor dynamicRefLineIndustrialColor;
250+
Wt::WColor dynamicRefLineNormColor;
251+
Wt::WColor dynamicRefLineSnmColor;
252+
Wt::WColor dynamicRefLineCommonColor;
253+
Wt::WColor dynamicRefLineOtherColor;
247254
};//struct ColorTheme
248255

249256

InterSpec/ColorThemeWidget.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ class ColorThemeWidget : public Wt::WContainerWidget
7878
TimeHistoryForegroundHighlight,
7979
TimeHistoryBackgroundHighlight,
8080
TimeHistorySecondaryHighlight,
81-
KineticRefLineDefault,
81+
DynamicRefLineMedical,
82+
DynamicRefLineIndustrial,
83+
DynamicRefLineNorm,
84+
DynamicRefLineSnm,
85+
DynamicRefLineCommon,
86+
DynamicRefLineOther,
8287
NumSelectableColors
8388
};//enum class EditableColor
8489

InterSpec/D3SpectrumDisplayDiv.h

Lines changed: 68 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SpecMeas;
2626
class PeakModel;
2727
class InterSpec;
2828
struct ColorTheme;
29-
class RefLineKinetic;
29+
class RefLineDynamic;
3030

3131
namespace Wt
3232
{
@@ -78,9 +78,9 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
7878
void setCompactAxis( const bool compact );
7979
bool isAxisCompacted() const;
8080

81-
Wt::Signal<double/*keV*/,double/*counts*/,int/*pageX*/,int/*pageY*/> &chartClicked();
82-
Wt::Signal<double/*kev*/,double/*counts*/,int/*pageX*/,int/*pageY*/> &rightClicked();
83-
Wt::Signal<double/*keV*/,double/*counts*/,std::string/*ref-line number*/> &doubleLeftClick();
81+
Wt::Signal<double/*keV*/,double/*counts*/,int/*pageX*/,int/*pageY*/,std::string/*ref-line name*/> &chartClicked();
82+
Wt::Signal<double/*kev*/,double/*counts*/,int/*pageX*/,int/*pageY*/,std::string/*ref-line name*/> &rightClicked();
83+
Wt::Signal<double/*keV*/,double/*counts*/,std::string/*ref-line name*/> &doubleLeftClick();
8484
Wt::Signal<double/*keV start*/,double/*keV end*/> &shiftKeyDragged();
8585

8686
/** When a previously existing ROI gets dragged by its edge, this signal will be emitted as it
@@ -283,6 +283,23 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
283283
/** Fills just the y-range of the chart, below the data. */
284284
BelowData
285285
};//enum class HighlightRegionFill
286+
287+
/** Reference line thickness options. */
288+
enum class RefLineThickness : int
289+
{
290+
Light = 0, ///< Light Lines: width=0.5, hover=1.0
291+
Normal = 1, ///< Normal Lines: width=1.0, hover=2.0 (default)
292+
Thick = 2, ///< Thick Lines: width=2.0, hover=3.0
293+
Thicker = 3 ///< Thicker Lines: width=3.0, hover=5.0
294+
};//enum class RefLineThickness
295+
296+
/** Reference line verbosity options for extension lines. */
297+
enum class RefLineVerbosity : int
298+
{
299+
None = 0, ///< No extension lines shown
300+
OnHover = 1, ///< Extension lines shown only on hover
301+
MajorAlways = 2 ///< Major lines always show extensions, all lines show on hover
302+
};//enum class RefLineVerbosity
286303

287304
size_t addDecorativeHighlightRegion( const float lowerx,
288305
const float upperx,
@@ -359,19 +376,37 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
359376
// should be shown for the line that the mouse is currently over. Default is
360377
// to show the information.
361378
void setShowRefLineInfoForMouseOver( const bool show );
379+
380+
/** Sets the width of reference lines. Default is 1 for normal width, 2 for hover width. */
381+
void setRefLineWidths( const double width, const double hoverWidth );
382+
383+
/** Sets reference line thickness from RefLineThickness enum. */
384+
void setRefLineThickness( const RefLineThickness thickness );
385+
386+
/** Gets the line widths for a given RefLineThickness enum value. */
387+
static std::pair<double,double> getRefLineWidths( const RefLineThickness thickness );
388+
389+
/** Callback for RefLineThickness preference changes (takes int parameter). */
390+
void handleRefLineThicknessPreferenceChangeCallback( int thickness );
391+
392+
/** Sets reference line verbosity from RefLineVerbosity enum. */
393+
void setRefLineVerbosity( const RefLineVerbosity verbosity );
394+
395+
/** Callback for RefLineVerbosity preference changes (takes int parameter). */
396+
void handleRefLineVerbosityPreferenceChangeCallback( int verbosity );
362397

363-
/** To avoid duplicate calculations of kinetic reference lines, the `RefLineKinetic` class will notify this class
364-
that it has updates, by calling the `scheduleRenderKineticRefLine()` function; this will also trigger a render
365-
update for this class. Then in the render function for this class, it will call back into RefLineKinetic, to have it do the
366-
calculations and give the results to this class (see #m_kineticRefLines and #m_kineticRefLinesJsFwhmFcn), to then be
398+
/** To avoid duplicate calculations of dynamic reference lines, the `RefLineDynamic` class will notify this class
399+
that it has updates, by calling the `scheduleRenderDynamicRefLine()` function; this will also trigger a render
400+
update for this class. Then in the render function for this class, it will call back into RefLineDynamic, to have it do the
401+
calculations and give the results to this class (see #m_dynamicRefLines and #m_dynamicRefLinesJsFwhmFcn), to then be
367402
sent to the client.
368403
*/
369-
void setKineticRefLineController( RefLineKinetic *kinetic );
404+
void setDynamicRefLineController( RefLineDynamic *dynamic );
370405

371-
/** Marks it so this class will call the `RefLineKinetic` instance to give this class the updated lines, on the next render cycle,
406+
/** Marks it so this class will call the `RefLineDynamic` instance to give this class the updated lines, on the next render cycle,
372407
and mark that this instance needs to be rendered.
373408
*/
374-
void scheduleRenderKineticRefLine();
409+
void scheduleRenderDynamicRefLine();
375410

376411
/** Set the reference lines that update as you move the mouse.
377412
@@ -382,7 +417,7 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
382417
If this widget is rendered, then lines are also put to `doJavaScript(...)` immediately during this call; if not rendered, then will wait until
383418
the render cycle to do this.
384419
*/
385-
void setKineticRefernceLines( std::vector<std::pair<double,ReferenceLineInfo>> &&ref_lines,
420+
void setDynamicRefernceLines( std::vector<std::pair<double,ReferenceLineInfo>> &&ref_lines,
386421
std::string &&js_fwhm_fcnt );
387422

388423
/** Highlights a peak, at the specified energy, as if you had moused over it.
@@ -429,7 +464,7 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
429464

430465
void setReferenceLinesToClient();
431466

432-
void setKineticRefLinesToClient();
467+
void setDynamicRefLinesToClient();
433468

434469
virtual void render( Wt::WFlags<Wt::RenderFlag> flags );
435470

@@ -448,7 +483,7 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
448483

449484
UpdateRefLines = 0x40,
450485

451-
UpdateKineticRefLines = 0x80
486+
UpdateDynamicRefLines = 0x80
452487
//ToDo: maybe add a few other things to this mechanism.
453488
};//enum D3RenderActions
454489

@@ -510,10 +545,15 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
510545
std::unique_ptr<Wt::JSignal<double, double> > m_shiftKeyDraggJS;
511546
std::unique_ptr<Wt::JSignal<double, double> > m_shiftAltKeyDraggJS;
512547
std::unique_ptr<Wt::JSignal<double, double> > m_rightMouseDraggJS;
513-
/** The double left-click std::string is the ReferenceLine name (including for kinetic ref lines) cooresponding to what the mouse is over at click time. */
548+
/** The rel-line name std::string below is the ReferenceLine (including for dynamic ref lines) cooresponding to what the mouse is over at click time.
549+
It will be empty if no line was actively showing its info, or else it will be the line cooresponding to the JS `SpectrumChartD3.mousedOverRefLine` variable.
550+
551+
The name of the reference lines (e.g., "U238", "H(n,g)") _may_ be followed by a semicolon, then information about the specific line.
552+
E.x. "Th232;S.E. of 2614.5 keV"
553+
*/
514554
std::unique_ptr<Wt::JSignal<double, double, std::string> > m_doubleLeftClickJS;
515-
std::unique_ptr<Wt::JSignal<double,double,double/*pageX*/,double/*pageY*/> > m_leftClickJS;
516-
std::unique_ptr<Wt::JSignal<double,double,double/*pageX*/,double/*pageY*/> > m_rightClickJS;
555+
std::unique_ptr<Wt::JSignal<double,double,double/*pageX*/,double/*pageY*/,std::string /*ref-line name*/> > m_leftClickJS;
556+
std::unique_ptr<Wt::JSignal<double,double,double/*pageX*/,double/*pageY*/,std::string /*ref-line name*/> > m_rightClickJS;
517557
/** Currently including chart area in pixels in xRange changed from JS; this
518558
size in pixels is only approximate, since chart may not have been totally layed out
519559
and rendered when this signal was emmitted.
@@ -539,9 +579,9 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
539579
Wt::Signal<double,double> m_shiftKeyDragg;
540580
Wt::Signal<double,double> m_shiftAltKeyDragg;
541581
Wt::Signal<double,double> m_rightMouseDragg;
542-
Wt::Signal<double,double,int/*pageX*/,int/*pageY*/> m_leftClick;
582+
Wt::Signal<double,double,int/*pageX*/,int/*pageY*/,std::string /*ref-line name*/> m_leftClick;
543583
Wt::Signal<double,double,std::string /*ref-line name*/> m_doubleLeftClick;
544-
Wt::Signal<double,double,int/*pageX*/,int/*pageY*/> m_rightClick;
584+
Wt::Signal<double,double,int/*pageX*/,int/*pageY*/,std::string /*ref-line name*/> m_rightClick;
545585

546586
Wt::Signal<double /*new roi lower energy*/,
547587
double /*new roi upper energy*/,
@@ -568,10 +608,9 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
568608
void chartShiftKeyDragCallback( double x0, double x1 );
569609
void chartShiftAltKeyDragCallback( double x0, double x1 );
570610
void chartRightMouseDragCallback( double x0, double x1 );
571-
void chartLeftClickCallback( double x, double y, double pageX, double pageY );
611+
void chartLeftClickCallback( double x, double y, double pageX, double pageY, const std::string &ref_line_name );
572612
void chartDoubleLeftClickCallback( double x, double y, const std::string &ref_line_name );
573-
void chartRightClickCallback( double x, double y, double pageX,
574-
double pageY );
613+
void chartRightClickCallback( double x, double y, double pageX, double pageY, const std::string &ref_line_name );
575614

576615
void existingRoiEdgeDragCallback( double new_lower_energy, double new_upper_energy,
577616
double new_lower_px, double new_upper_px,
@@ -616,10 +655,14 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
616655
std::vector<ReferenceLineInfo> m_persistedPhotoPeakLines;
617656

618657
bool m_showRefLineInfoForMouseOver;
658+
double m_refLineWidth;
659+
double m_refLineWidthHover;
660+
661+
RefLineVerbosity m_refLineVerbosity;
619662

620-
RefLineKinetic *m_kinetic;
621-
std::vector<std::pair<double,ReferenceLineInfo>> m_kineticRefLines;
622-
std::string m_kineticRefLinesJsFwhmFcn;
663+
RefLineDynamic *m_dynamic;
664+
std::vector<std::pair<double,ReferenceLineInfo>> m_dynamicRefLines;
665+
std::string m_dynamicRefLinesJsFwhmFcn;
623666

624667
bool m_showFeatureMarker[static_cast<int>(FeatureMarkerType::NumFeatureMarkers)];
625668

InterSpec/DetectorPeakResponse.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,22 @@ class DetectorPeakResponse
609609
const std::string &description() const;
610610
DrfSource drfSource() const;
611611

612+
/** Prints detector parameterization to stdout for hardcoding purposes.
613+
Prints out all the key parameters needed to recreate this detector response function
614+
programmatically, including efficiency coefficients, FWHM coefficients, detector size, etc.
615+
*/
616+
void printDetectorParameterizationToStdout() const;
617+
618+
/** Static factory methods for common detector types with lazy initialization and caching.
619+
These methods return const shared_ptrs to pre-configured detector response functions
620+
for commonly used detector types. Thread-safe with single initialization.
621+
*/
622+
static std::shared_ptr<const DetectorPeakResponse> getGenericHPGeDetector();
623+
static std::shared_ptr<const DetectorPeakResponse> getGenericNaIDetector();
624+
static std::shared_ptr<const DetectorPeakResponse> getGenericLaBrDetector();
625+
static std::shared_ptr<const DetectorPeakResponse> getGenericCZTGeneralDetector();
626+
static std::shared_ptr<const DetectorPeakResponse> getGenericCZTGoodDetector();
627+
612628
float efficiencyEnergyUnits() const;
613629

614630
//Simple setters (all recompute hash value)

0 commit comments

Comments
 (0)