Skip to content

Commit fd9adbb

Browse files
committed
Merge branch 'master' of github.com:sandialabs/InterSpec
2 parents 80b9896 + 7f9f723 commit fd9adbb

File tree

194 files changed

+4191
-15617
lines changed

Some content is hidden

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

194 files changed

+4191
-15617
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ set(sources
532532
src/MakeDrfFit.cpp
533533
src/FluxTool.cpp
534534
src/NativeFloatSpinBox.cpp
535+
src/SwitchCheckbox.cpp
535536
src/EnergyCalTool.cpp
536537
src/EnergyCal.cpp
537538
src/EnergyCalGraphical.cpp
@@ -616,6 +617,7 @@ set(headers
616617
InterSpec/MakeDrfFit.h
617618
InterSpec/FluxTool.h
618619
InterSpec/NativeFloatSpinBox.h
620+
InterSpec/SwitchCheckbox.h
619621
InterSpec/EnergyCalTool.h
620622
InterSpec/EnergyCal.h
621623
InterSpec/EnergyCalGraphical.h

InterSpec/D3SpectrumDisplayDiv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class D3SpectrumDisplayDiv : public Wt::WContainerWidget
9595
void setPeakModel( PeakModel *model );
9696

9797
void setData( std::shared_ptr<SpecUtils::Measurement> data_hist, const bool keep_curent_xrange );
98-
void setSecondData( std::shared_ptr<SpecUtils::Measurement> hist, const bool ownAxis );
98+
void setSecondData( std::shared_ptr<SpecUtils::Measurement> hist );
9999
void setBackground( std::shared_ptr<SpecUtils::Measurement> background );
100100

101101
void scheduleUpdateForeground();

InterSpec/D3TimeChart.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ class D3TimeChart : public Wt::WContainerWidget
142142
bool verticalLinesShowing() const;
143143
bool horizontalLinesShowing() const;
144144

145+
void setDontRebin( const bool dontRebin );
146+
bool dontRebin() const;
147+
148+
void setNeutronsHidden( const bool hide );
149+
bool neutronsHidden() const;
150+
145151
void setXAxisRangeSamples( const int min_sample_num, const int max_sample_num );
146152

147153
/** Returns the current user-entered gamma energy range that should be summed to create this gross count chart. */
@@ -241,7 +247,8 @@ class D3TimeChart : public Wt::WContainerWidget
241247
bool m_compactXAxis;
242248
bool m_showVerticalLines;
243249
bool m_showHorizontalLines;
244-
250+
bool m_dontRebin;
251+
bool m_hideNeutrons;
245252

246253
std::shared_ptr<const SpecUtils::SpecFile> m_spec;
247254

InterSpec/DetectorEdit.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ class DetectorEdit : public Wt::WContainerWidget
220220
// on deplandcies)
221221
static std::shared_ptr<DetectorPeakResponse> initARelEffDetector( const SpecUtils::DetectorType type, InterSpec *interspec );
222222

223+
224+
/** Checks if file at passed in path is a TSV/CSV file that contains
225+
coefficients for the exp( c0 + c1*logx + c2*logx^2 + ...) equation.
226+
If so, returns detector. If not, returns nullptr.
227+
228+
ToDo: Currently reads in most of the information exported in the CSV from MakeDrf tool, but maybe not all.
229+
*/
230+
static std::shared_ptr<DetectorPeakResponse> parseRelEffCsvFile( const std::string filePath );
231+
232+
223233
//Callbacks for when detector is changed or modified
224234
void gadrasDetectorSelectCallback();
225235
void relEffDetectorSelectCallback();
@@ -259,20 +269,13 @@ class DetectorEdit : public Wt::WContainerWidget
259269
//a row is selected, so update det and charts
260270
void dbTableSelectionChanged();
261271

272+
262273
protected:
263274
void setAcceptButtonEnabled( const bool enable );
264275

265-
/** Checks if file at passed in path is a TSV/CSV file that contains
266-
coeffeicents for the exp( c0 + c1*logx + c2*logx^2 + ...) equation.
267-
If so, returns detector. If not, returns nullptr.
268-
269-
ToDo: Currently reads in most of the information exported in the CSV from
270-
MakeDrf tool, except the uncertainities - should add this in. Also, need
271-
to cleanup the GUI during loading of this one CSV that has all the info
272-
(def not correct, should hide detector diameter and option to upload
273-
Detector.dat).
274-
*/
275-
static std::shared_ptr<DetectorPeakResponse> checkIfFileIsRelEff( const std::string tsvfilepath );
276+
/** Called when user changes value in m_uploadedDetName; sets m_detector name. */
277+
void handleUserChangedUploadedDrfName();
278+
276279

277280
protected:
278281
WContainerWidget *m_footer;
@@ -315,6 +318,8 @@ class DetectorEdit : public Wt::WContainerWidget
315318
Wt::WTabWidget *m_tabs;
316319

317320
Wt::WLineEdit *m_detectorDiameter;
321+
Wt::WContainerWidget *m_uploadedDetNameDiv;
322+
Wt::WLineEdit *m_uploadedDetName;
318323
Wt::WContainerWidget *m_detectrDiameterDiv;
319324
Wt::WFileUpload *m_efficiencyCsvUpload;
320325
Wt::WContainerWidget *m_detectrDotDatDiv;

InterSpec/DetectorPeakResponse.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,15 @@ class DetectorPeakResponse
332332
333333
\param coefs The coefficients for the exp(A0 + A1*log(x) + A2*log(x)^2...)
334334
equation. If coefficients are not for intrinsic efficiency (e.g.,
335-
characterizationDist is not 0.0), they coeffcients will be converted
335+
characterizationDist is not 0.0), they coefficients will be converted
336336
to intrinsic for internal use
337-
\param characterizationDist Distance used when fitting coefficents. If
337+
\param uncerts The uncertainties of the coefficients; must either be empty,
338+
or the same size as \p coefs.
339+
\param characterizationDist Distance used when fitting coefficients. If
338340
coefficients are for intrinsic efficiency, then this value will be
339341
0.0f.
340-
\param equationEnergyUnits The energy units equation should be evalueated
341-
in. If equn is in MeV, this will be 1000. If in keV, will be 1.0.
342+
\param equationEnergyUnits The energy units equation should be evaluated
343+
in. If eqn is in MeV, this will be 1000. If in keV, will be 1.0.
342344
\param lowerEnergy Lower energy, in keV, the equation is good for; if
343345
unknown pass a value of 0.0f for this parameter and upperEnergy.
344346
\param upperEnergy Upper energy, in keV, the equation is good for; if
@@ -347,6 +349,7 @@ class DetectorPeakResponse
347349
Recomputes hash value.
348350
*/
349351
void fromExpOfLogPowerSeriesAbsEff( const std::vector<float> &coefs,
352+
const std::vector<float> &uncerts,
350353
const float characterizationDist,
351354
const float detector_diameter,
352355
const float equationEnergyUnits,

InterSpec/EnergyCalMultiFile.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,15 @@ class EnergyCalMultiFileModel : public Wt::WAbstractItemModel
116116
void refreshData();
117117

118118
protected:
119-
typedef std::tuple< std::shared_ptr<const SpecUtils::EnergyCalibration>, \
120-
bool, \
121-
std::shared_ptr<const PeakDef>, \
122-
std::shared_ptr<SpectraFileHeader> > PeakInfo_t;
119+
typedef std::tuple< bool, std::shared_ptr<const PeakDef> > UsePeakInfo_t;
120+
121+
typedef std::tuple<std::shared_ptr<SpectraFileHeader>, \
122+
std::set<int>, \
123+
std::shared_ptr<const SpecUtils::EnergyCalibration>, \
124+
std::vector<UsePeakInfo_t> > SamplesPeakInfo_t;
125+
126+
std::vector<std::vector<SamplesPeakInfo_t>> m_data;
123127

124-
std::vector< std::vector<PeakInfo_t> > m_peaks;
125128
EnergyCalTool *m_calibrator;
126129
SpectraFileModel *m_fileModel;
127130

InterSpec/GadrasGamFileParser.h

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,65 +28,103 @@
2828
#include <iostream>
2929

3030
/** Opens GADRAS GAM files.
31-
* Opens only the newer format of GAM files (that start with two 0's).
31+
*
32+
* Currently only opens .gam files that start with two 0's, called version 1, and GamFileVersion = 2.0 and 2.1.
33+
*
34+
* Does not currently parse all information, such as model geometry, largest dimension, multiplicity, etc.
3235
*/
3336
class GadrasGamFile
3437
{
3538
public:
3639
GadrasGamFile();
3740

3841

39-
/** Parses the cooresponding stream.
42+
/** Parses the corresponding stream.
4043
* Throws runtime_error exception when the file is not formatted properly.
4144
*/
4245
void parse_data( std::istream &strm );
4346

4447

48+
enum class GamFileVersion
49+
{
50+
/** The .gam files that start with two 0's.
51+
The gamma lines do not include shielding information.
52+
*/
53+
Version_1,
54+
55+
/** Indicated by a "GamFileVersion = 2.0" header in the file. */
56+
Version_2_0,
57+
58+
/** Indicated by a "GamFileVersion = 2.1" header in the file. */
59+
Version_2_1,
60+
61+
/** */
62+
NumGamFileVersions
63+
};//enum class GamFileVersion
4564

46-
/* A relevant note from the GADRAS users manual:
47-
* If the width of the group exceeds 1% of the average energy of the group,
48-
* the radiation within the group is assumed to be distributed uniformly
49-
* within the group. For groups that have widths under 1% of the average
50-
* energy, any excess flux within the group relative to a linear interpolation
51-
* of surrounding groups is assumed to be emitted at a discrete energy,
52-
* corresponding to the midpoint of the group.
65+
66+
/** Writes the .gam file to the provided stream.
67+
*
68+
* Currently only supports writing GamFileVersion::Version_2_0, and will throw exception for other versions.
69+
*
70+
* Throws runtime_error exception if output fails or errors encountered.
71+
*/
72+
void write_gam( std::ostream &output, const GamFileVersion version );
73+
74+
75+
/*
76+
A relevant note is:
77+
If the width, W, or a photon group with lower energy EL, meets any of the following conditions,
78+
GADRAS transport will treat the group as a discrete line:
79+
- W < 0.25 keV
80+
- W < 0.4 keV and EL > 200 keV
81+
- W < 1.0 keV and EL > 10 MeV
82+
If any of these conditions are met, GADRAS will look at the (assumed) continuum groups above and
83+
below the potential discrete group. The counts-per-keV in the potential discrete group must be
84+
greater than the adjacent continuum groups. If it is, it uses the higher-energy continuum group
85+
and subtracts those counts from the discrete group to get the net discrete counts, with energy
86+
equal to the midpoint of the group.
87+
*/
88+
89+
/** The gamma file version parsed.
5390
*/
91+
GamFileVersion m_version;
5492

55-
/** Energy, in keV of the un-collided gamma rays.
93+
/** Energy, in keV of the un-collided gamma rays.
5694
* Will have same number of entries as, and coorespond index-wise to
5795
* #m_photon_lines_flux, #m_photon_lines_an, and #m_photon_lines_ad.
5896
*/
5997
std::vector<float> m_photon_lines_energy;
6098

61-
/** The flux into 4pi for the cooresponding m_photon_lines_energy energy.*/
99+
/** The flux into 4pi for the corresponding m_photon_lines_energy energy.*/
62100
std::vector<float> m_photon_lines_flux;
63101

64-
/** The yeild-effective weighted atomic number of interveining material. */
102+
/** The yield-effective weighted atomic number of intervening material. */
65103
std::vector<float> m_photon_lines_an;
66104

67-
/** The yield-effective weighted areal density of interveining material. */
105+
/** The yield-effective weighted areal density of intervening material. */
68106
std::vector<float> m_photon_lines_ad;
69107

70108

71-
/** Lower energy of energy group for the cooresponding (index-wise)
109+
/** Lower energy of energy group for the corresponding (index-wise)
72110
* #m_photon_group_flux. Energy is in keV.
73111
*/
74112
std::vector<float> m_photon_group_boundries;
75113

76-
/** Flux of the continuum for the given energy group.
114+
/** Flux of the continuum for the given energy group.
77115
* Note that the last last entry should have a flux of 0, in order to allow
78116
* defining the upper energy of the last group.
79117
*/
80118
std::vector<float> m_photon_group_flux;
81119

82120

83-
/** Lower energy of the neutron energy group. Will have same number of
121+
/** Lower energy of the neutron energy group. Will have same number of
84122
* entries as #m_neutron_group_flux.
85123
* Energy is in keV (note that .gam files use eV).
86124
*/
87125
std::vector<float> m_neutron_group_boundries;
88126

89-
/** Flux in cooresponding energy group.
127+
/** Flux in corresponding energy group.
90128
*/
91129
std::vector<float> m_neutron_group_flux;
92130
};//class GadrasGamFile

0 commit comments

Comments
 (0)