Skip to content

Commit c984607

Browse files
committed
Merge branch 'master' into feature/showNonForePeaks
2 parents 691ef45 + 4483b3d commit c984607

File tree

5 files changed

+45
-9
lines changed

5 files changed

+45
-9
lines changed

bindings/python/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
66

77
set( SpecUtils_ENABLE_D3_CHART ON CACHE BOOL "" )
88
set( SpecUtils_D3_SUPPORT_FILE_STATIC ON CACHE BOOL "" )
9-
set( SpecUtils_ENABLE_URI_SPECTRA OFF CACHE BOOL "" ) #Lets not worry about linking to zlib right now
109
set( SpecUtils_PYTHON_BINDINGS ON CACHE BOOL "Build the python bindings" )
1110
set( SpecUtils_ENABLE_EQUALITY_CHECKS OFF CACHE BOOL "" )
1211
set( PERFORM_DEVELOPER_CHECKS OFF CACHE BOOL "" )
1312
set( SpecUtils_SHARED_LIB OFF CACHE BOOL "" ) #we'll statically link SpecUtils into the lib we create here
1413
set( SpecUtils_FLT_PARSE_METHOD "strtod" CACHE STRING "Float parsing method" )
1514

15+
# Enable URI spectra for macOS and Linux (since we are already linking to zlib), but not Windows
16+
if(WIN32)
17+
set( SpecUtils_ENABLE_URI_SPECTRA OFF CACHE BOOL "" )
18+
else()
19+
set( SpecUtils_ENABLE_URI_SPECTRA ON CACHE BOOL "" )
20+
endif()
21+
1622
add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/../.. ${CMAKE_CURRENT_BINARY_DIR}/LibSpecUtils )
1723

1824
if (NOT SKBUILD)

bindings/python/SpecFile_py.cpp

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,9 @@ NB_MODULE(SpecUtils, m) {
13541354
.value("ScanDataXml", SpecUtils::ParserType::ScanDataXml)
13551355
.value("Json", SpecUtils::ParserType::Json)
13561356
.value("CaenHexagonGXml", SpecUtils::ParserType::CaenHexagonGXml)
1357+
#if( SpecUtils_ENABLE_URI_SPECTRA )
1358+
.value("Uri", SpecUtils::ParserType::Uri)
1359+
#endif
13571360
.value("Auto", SpecUtils::ParserType::Auto);
13581361

13591362

@@ -2051,8 +2054,33 @@ m.def("polynomialCoefToFullRangeFraction",
20512054
"Changes the name of a given detector.\n"
20522055
"Throws exception if 'OriginalName' did not exist." )
20532056

2054-
//size_t combine_gamma_channels( const size_t ncombine, const size_t nchannels );
2055-
//size_t truncate_gamma_channels( ...)
2057+
.def( "truncateGammaChannels",
2058+
static_cast<size_t (SpecUtils::SpecFile::*)(const size_t, const size_t, const size_t, const bool)>(&SpecUtils::SpecFile::truncate_gamma_channels),
2059+
"KeepFirstChannel"_a, "KeepLastChannel"_a, "NChannels"_a, "KeepUnderOverFlow"_a,
2060+
"Removes all channels below 'KeepFirstChannel' and above 'KeepLastChannel', "
2061+
"for every measurement that has 'NChannels' channels.\n"
2062+
"If 'KeepUnderOverFlow' is true, then removed channel counts will be added to the first/last channel.\n"
2063+
"Returns the number of modified measurements.\n"
2064+
"Throws exception if KeepLastChannel>=NChannels, or if KeepFirstChannel>=KeepLastChannel." )
2065+
.def( "truncateGammaChannels",
2066+
static_cast<void (SpecUtils::SpecFile::*)(const size_t, const size_t, const bool, const std::shared_ptr<const SpecUtils::Measurement> &)>(&SpecUtils::SpecFile::truncate_gamma_channels),
2067+
"KeepFirstChannel"_a, "KeepLastChannel"_a, "KeepUnderOverFlow"_a, "Measurement"_a,
2068+
"Removes all channels below 'KeepFirstChannel' and above 'KeepLastChannel' for the specified measurement.\n"
2069+
"If 'KeepUnderOverFlow' is true, then removed channel counts will be added to the first/last channel.\n"
2070+
"Throws exception if invalid Measurement, or if KeepLastChannel>=measurement.num_gamma_channels(), "
2071+
"or if KeepFirstChannel>=KeepLastChannel." )
2072+
.def( "combineGammaChannels",
2073+
static_cast<size_t (SpecUtils::SpecFile::*)(const size_t, const size_t)>(&SpecUtils::SpecFile::combine_gamma_channels),
2074+
"NCombine"_a, "NChannels"_a,
2075+
"Combines every 'NCombine' adjacent channels into a single channel for every measurement "
2076+
"that has 'NChannels' channels.\n"
2077+
"Returns the number of modified measurements.\n"
2078+
"Throws exception if (NChannels % NCombine) != 0." )
2079+
.def( "combineGammaChannels",
2080+
static_cast<void (SpecUtils::SpecFile::*)(const size_t, const std::shared_ptr<const SpecUtils::Measurement> &)>(&SpecUtils::SpecFile::combine_gamma_channels),
2081+
"NCombine"_a, "Measurement"_a,
2082+
"Combines every 'NCombine' adjacent channels into a single channel for the specified measurement.\n"
2083+
"Throws exception if measurement is not owned by this SpecFile." )
20562084

20572085
// Begin functions that set Measurement quantities, through thier SpecFile owner
20582086
.def( "setLiveTime", &SpecUtils::SpecFile::set_live_time,

bindings/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "SandiaSpecUtils"
7-
version = "0.0.6"
7+
version = "0.0.9"
88
description = "Python bindings for SpecUtils using nanobind and scikit-build"
99
readme = "README.md"
1010
requires-python = ">=3.9"

d3_resources/SpectrumChartD3.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ svg.SpectrumChartD3 {
197197
.mouseInfoBox{ fill: white; fill-opacity: 0.85; }
198198

199199
.refLineCandidatesText {
200-
font-size: 0.8em;
200+
font-size: 1.2em;
201201
/* Not setting fill, so defaults to black - should be same behaviour as legend. */
202202
/* fill: var(--d3spec-text-color, black); */
203203
}

d3_resources/SpectrumChartD3.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4121,7 +4121,6 @@ SpectrumChartD3.prototype.setKineticReferenceLines = function( data ) {
41214121
} );
41224122
} );
41234123
}//if( data )
4124-
//console.log( "setKineticReferenceLines:", data );
41254124

41264125
this.kineticRefLines = data;
41274126

@@ -4138,6 +4137,7 @@ SpectrumChartD3.prototype.handleUpdateKineticRefLineUpdate = function(){
41384137
this.currentKineticRefLineIndex = 0;
41394138
this.stopKineticRefLineCycling();
41404139
this.drawRefGammaLines();
4140+
this.updateKineticRefLineCandidateDisplay();
41414141
}
41424142
return;
41434143
}//if( we dont need to draw the lines )
@@ -4266,10 +4266,12 @@ SpectrumChartD3.prototype.startKineticRefLineCycling = function(){
42664266
const self = this;
42674267

42684268
this.stopKineticRefLineCycling();
4269-
4270-
if( this.candidateKineticRefLines.length <= 1 ) {
4269+
if( this.candidateKineticRefLines.length <= 1 )
42714270
return;
4272-
}
4271+
4272+
// If an element has active focus, then the arrow keys may not get through
4273+
if (document.activeElement instanceof HTMLElement)
4274+
document.activeElement.blur();
42734275

42744276
this.kineticRefLineCycleTimer = setInterval(function(){
42754277
if( self.kineticRefLineCycleTimer && self.candidateKineticRefLines.length > 1 ) {

0 commit comments

Comments
 (0)