Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohns committed Jun 15, 2024
2 parents 8db488d + 4f32de2 commit be819d3
Show file tree
Hide file tree
Showing 206 changed files with 19,006 additions and 6,645 deletions.
44 changes: 18 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ else( hasParent )
endif( hasParent )


option(
BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT
"Build executable for use while testing new code, not running InterSpec"
OFF
)
option(
INCLUDE_ANALYSIS_TEST_SUITE
"Allow whether user can save and load test spectra"
Expand Down Expand Up @@ -77,7 +72,7 @@ option(USE_DB_TO_STORE_SPECTRA "Use the database to store spectra" ON)
option(
USE_SPECRUM_FILE_QUERY_WIDGET
"Enables compilation of the spectrum file query tool (not for web deployment)"
OFF
ON
)
option(
USE_SEARCH_MODE_3D_CHART
Expand All @@ -86,7 +81,7 @@ option(
)
option(USE_TERMINAL_WIDGET "Enables use of terminal widget" ON)

option(USE_DETECTION_LIMIT_TOOL "Enables under-development detection limit tool" OFF)
option(USE_DETECTION_LIMIT_TOOL "Enables under-development detection limit tool" ON)

option(USE_QR_CODES "Enables generating QR codes for like DRFs" ON)

Expand Down Expand Up @@ -181,14 +176,6 @@ if(NOT CMAKE_BUILD_TYPE)
endif(NOT CMAKE_BUILD_TYPE)


if(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
set(PERFORM_DEVELOPER_CHECKS ON CACHE INTERNAL "")
set(SpecUtils_ENABLE_EQUALITY_CHECKS ON CACHE INTERNAL "")
endif(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)




if(BUILD_FOR_WEB_DEPLOYMENT)
set(TRY_TO_STATIC_LINK ON)
set(CMAKE_BUILD_TYPE:STRING "Release")
Expand Down Expand Up @@ -253,6 +240,7 @@ set(sources
src/IsotopeId.cpp
src/MaterialDB.cpp
src/PhysicalUnits.cpp
src/PhysicalUnitsLocalized.cpp
src/MassAttenuationTool.cpp
src/DetectorPeakResponse.cpp
src/GammaInteractionCalc.cpp
Expand Down Expand Up @@ -344,6 +332,8 @@ set(sources
src/AppUtils.cpp
src/ExportSpecFile.cpp
src/EnterAppUrlWindow.cpp
src/NuclideSourceEnter.cpp
src/AddNewPeakDialog.cpp
js/SpectrumChart.js
js/InterSpec.js
)
Expand All @@ -356,6 +346,7 @@ set(headers
InterSpec/IsotopeId.h
InterSpec/MaterialDB.h
InterSpec/PhysicalUnits.h
InterSpec/PhysicalUnitsLocalized.h
InterSpec/MassAttenuationTool.h
InterSpec/DetectorPeakResponse.h
InterSpec/GammaInteractionCalc.h
Expand Down Expand Up @@ -444,6 +435,8 @@ set(headers
InterSpec/AppUtils.h
InterSpec/ExportSpecFile.h
InterSpec/EnterAppUrlWindow.h
InterSpec/NuclideSourceEnter.h
InterSpec/AddNewPeakDialog.h
)


Expand All @@ -460,12 +453,6 @@ if(INCLUDE_ANALYSIS_TEST_SUITE)
endif(INCLUDE_ANALYSIS_TEST_SUITE)


if(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
list(APPEND sources testing/developcode.cpp )
list(APPEND headers testing/developcode.h )
endif(BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)


#if(IOS)
# list(APPEND sources target/ios/InterSpec/FileHandling.mm)
# list(APPEND headers target/ios/InterSpec/FileHandling.h)
Expand Down Expand Up @@ -493,8 +480,8 @@ if(USE_TERMINAL_WIDGET)
endif(USE_TERMINAL_WIDGET)

if(USE_DETECTION_LIMIT_TOOL)
list( APPEND sources src/DetectionLimitCalc.cpp src/DetectionLimitTool.cpp )
list( APPEND headers InterSpec/DetectionLimitCalc.h InterSpec/DetectionLimitTool.h )
list( APPEND sources src/DetectionLimitCalc.cpp src/DetectionLimitTool.cpp src/DetectionLimitSimple.cpp )
list( APPEND headers InterSpec/DetectionLimitCalc.h InterSpec/DetectionLimitTool.h InterSpec/DetectionLimitSimple.h )
endif(USE_DETECTION_LIMIT_TOOL)

if(USE_QR_CODES)
Expand Down Expand Up @@ -662,10 +649,10 @@ target_link_libraries(
${CMAKE_DL_LIBS}
)

if(USE_SPECRUM_FILE_QUERY_WIDGET OR BUILD_AS_COMMAND_LINE_CODE_DEVELOPMENT)
if( USE_SPECRUM_FILE_QUERY_WIDGET )
add_subdirectory(external_libs/pugixml-1.9)
target_link_libraries(InterSpecLib PUBLIC pugixml)
endif()
endif( USE_SPECRUM_FILE_QUERY_WIDGET )


if(USE_MYSQL_DB EQUAL USE_SQLITE3_DB)
Expand All @@ -688,7 +675,7 @@ target_include_directories( InterSpecLib
if( InterSpec_FETCH_DEPENDENCIES )
target_link_libraries( InterSpecLib
PUBLIC
Boost::math Boost::scope_exit Boost::uuid Boost::iostreams Boost::assign Boost::multi_array Boost::crc
Boost::math Boost::scope_exit Boost::uuid Boost::iostreams Boost::assign Boost::multi_array Boost::crc Boost::process
# Boost::signals2 Boost::asio Boost::multi_index
wt
# wttest
Expand Down Expand Up @@ -871,6 +858,11 @@ list( APPEND OTHER_InterSpec_SUPPORT_FILES
add_custom_target(interspec_resources SOURCES ${OTHER_InterSpec_SUPPORT_FILES})


# Make a target for the XML files that hold the (internationalized) text for the app
FILE(GLOB APP_TEXT_FILES InterSpec_resources/app_text/*.xml )
add_custom_target( interspec_app_text SOURCES ${APP_TEXT_FILES} )


#Copy files to the install directory
foreach(_file ${OTHER_FILES})
configure_file(
Expand Down
135 changes: 135 additions & 0 deletions InterSpec/AddNewPeakDialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#ifndef AddNewPeakDialog_h
#define AddNewPeakDialog_h
/* InterSpec: an application to analyze spectral gamma radiation data.
Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC
(NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
Government retains certain rights in this software.
For questions contact William Johnson via email at wcjohns@sandia.gov, or
alternative emails of interspec@sandia.gov.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "InterSpec_config.h"

#include <memory>

#include "InterSpec/AuxWindow.h"


//Forward declarations
class PeakModel;
class InterSpec;

namespace Wt
{
class WText;
class WCheckBox;
class WComboBox;
class WPushButton;
}//namespace Wt

namespace SpecUtils
{
class Measurement;
}

class NativeFloatSpinBox;

/** Creates a window the user can add a peak to the spectrum, specifying the peak
parameters, and seeing a preview of the peak as they go.
A number of improvements should be made:
- Support undo/redo
- Switch to using d3-based spectrum plot
- Add step-continuum types
- Allow users to edit continuum parameters, and choose to fit each one individually or not
*/
class AddNewPeakDialog : public AuxWindow
{
public:
static const float m_minfwhm;// = 0.05f;
static const float m_maxfwhm;// = 450.0f; //reasonable range of peak widths

protected:
/** Flags for what to do in `render(flags)` funciton */
enum RenderActions
{
UpdatePreview = 0x01,
};//enum D3RenderActions

Wt::WFlags<AddNewPeakDialog::RenderActions> m_renderFlags;


InterSpec *m_viewer;
PeakModel *m_peakModel;
bool m_isPhone;
std::shared_ptr<const SpecUtils::Measurement> m_meas;

std::shared_ptr<PeakDef> m_candidatePeak;

NativeFloatSpinBox *m_energySB;
NativeFloatSpinBox *m_fwhmSB;
NativeFloatSpinBox *m_areaSB;
NativeFloatSpinBox *m_roiLowerSB;
NativeFloatSpinBox *m_roiUpperSB;

Wt::WComboBox *m_continuumType;

Wt::WPushButton *m_fitBtn;
Wt::WCheckBox *m_fitEnergy;
Wt::WCheckBox *m_fitFWHM;
Wt::WCheckBox *m_fitAmplitude;

Wt::WText *m_chart;

public:

AddNewPeakDialog( const float initialEnergy );

/** Estimates the peak FWHM to initially use for an energy.
To get the FWHM:
1) see if there is a peak above and below the current one, if so interpolate
2) see if there are auto-search peaks above and below the current one, if so interpolate
3) see if DRF contains FWHM
4) see if there is a peak above or below, and scale by sqrt
5) Guess based on number of bins.
*/
float estimateFWHM( const float energy );

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

void updateCandidatePeakPreview();

void roiTypeChanged();

void meanChanged();


void fwhmChanged();


void ampChanged();


void roiRangeChanged();

void doFit();
};//class AddNewPeakDialog : public AuxWindow

#endif //AddNewPeakDialog_h
3 changes: 3 additions & 0 deletions InterSpec/AppUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ namespace AppUtils
if you pass in a URI of "interspec://decay/chain?nuclide=U238&activity=3uCi..."
then host=="decay", path=="chain", and query=="nuclide=U238&activity=3uCi..."
Please note, if you pass in a URI of "currie?ver=1&nuc=Ba133&...", then host=="currie",
path=="", and query=="ver=1&nuc=Ba133&...".
You should url-decode the uri, before passing it in, because, for example the '?' character
is not in the allowed QR code ascii set
*/
Expand Down
6 changes: 4 additions & 2 deletions InterSpec/AuxWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ enum AuxWindowProperties
IsModal = 0x04,

/** Styles the window to be an InterSpec help window. */
IsHelpWIndow = 0x08,
IsHelpWindow = 0x08,

/** Dont allow the window to be collapsed. TODO: invert this to default to not allowing collapse. */
DisableCollapse = 0x10,
Expand Down Expand Up @@ -261,7 +261,9 @@ class AuxWindow : public Wt::WDialog
// "DialogClose"
//The button is not connected to any slots (e.g. it does not actually close
// this dialog).
Wt::WPushButton *addCloseButtonToFooter(std::string overide="Close", bool floatright=false, Wt::WContainerWidget * footerOverride=NULL);
Wt::WPushButton *addCloseButtonToFooter( Wt::WString override_txt = "Close",
const bool float_right = false,
Wt::WContainerWidget *footerOverride = nullptr );

//Help button add to footer
static void addHelpInFooter(Wt::WContainerWidget *footer, std::string page );
Expand Down
Loading

0 comments on commit be819d3

Please sign in to comment.