Skip to content

Commit 0ccc04f

Browse files
committed
Merge branch 'ckuethe-more_radiacode'
2 parents f76562c + 236af80 commit 0ccc04f

File tree

9 files changed

+110
-37
lines changed

9 files changed

+110
-37
lines changed

SpecUtils/SpecFile.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,12 @@ enum class DetectorType : int
341341
Falcon5000,
342342
MicroDetective,
343343
MicroRaider,
344-
/** Scan-Electronics RadiaCode-10x detector with CsI(Tl) scintillator */
345-
RadiaCode,
344+
/** Scan-Electronics RadiaCode-10x detector with 10x10x10mm CsI(Tl) scintillator */
345+
RadiaCodeCsI10,
346+
/** Scan-Electronics RadiaCode-110 detector with 14x14x14mm CsI(Tl) scintillator */
347+
RadiaCodeCsI14,
348+
/** Scan-Electronics RadiaCode-103G detector with 10x10x10mm GAGG scintillator */
349+
RadiaCodeGAGG10,
346350

347351
/** Raysid 5cm³ CsI/Tl detector */
348352
Raysid,

bindings/c/SpecUtils_c.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,13 @@ static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_MicroDetec
221221
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_MicroRaider)
222222
== static_cast<int>(SpecUtils::DetectorType::MicroRaider),
223223
"SpecUtils_DetectorType needs updating" );
224-
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_RadiaCode)
225-
== static_cast<int>(SpecUtils::DetectorType::RadiaCode),
224+
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_RadiaCodeCsI10)
225+
== static_cast<int>(SpecUtils::DetectorType::RadiaCodeCsI10),
226226
"SpecUtils_DetectorType needs updating" );
227-
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_Interceptor)
227+
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_Raysid)
228+
== static_cast<int>(SpecUtils::DetectorType::Raysid),
229+
"SpecUtils_DetectorType needs updating" );
230+
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_Interceptor)
228231
== static_cast<int>(SpecUtils::DetectorType::Interceptor),
229232
"SpecUtils_DetectorType needs updating" );
230233
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_RadHunterNaI)
@@ -287,6 +290,12 @@ static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_Verifinder
287290
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_KromekD3S)
288291
== static_cast<int>(SpecUtils::DetectorType::KromekD3S),
289292
"SpecUtils_DetectorType needs updating" );
293+
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_KromekD5)
294+
== static_cast<int>(SpecUtils::DetectorType::KromekD5),
295+
"SpecUtils_DetectorType needs updating" );
296+
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_KromekGR1)
297+
== static_cast<int>(SpecUtils::DetectorType::KromekGR1),
298+
"SpecUtils_DetectorType needs updating" );
290299
static_assert( static_cast<int>(SpecUtils_DetectorType::SpecUtils_Det_Fulcrum)
291300
== static_cast<int>(SpecUtils::DetectorType::Fulcrum),
292301
"SpecUtils_DetectorType needs updating" );
@@ -1353,6 +1362,8 @@ bool SpecUtils_SpecFile_set_measurement_source_type( SpecUtils_SpecFile *instanc
13531362

13541363
const SpecUtils::SourceType st = SpecUtils::SourceType( static_cast<int>(type) );
13551364
specfile->set_source_type( st, m );
1365+
1366+
return true;
13561367
}
13571368

13581369

@@ -1371,6 +1382,8 @@ bool SpecUtils_SpecFile_set_measurement_position( SpecUtils_SpecFile *instance,
13711382
tp += chrono::microseconds( microseconds_since_unix_epoch );
13721383

13731384
specfile->set_position( longitude, latitude, tp, m );
1385+
1386+
return true;
13741387
}
13751388

13761389

bindings/c/SpecUtils_c.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,17 @@ enum SpecUtils_DetectorType
459459
SpecUtils_Det_DetectiveEx, SpecUtils_Det_DetectiveEx100, SpecUtils_Det_DetectiveEx200,
460460
SpecUtils_Det_DetectiveX, SpecUtils_Det_SAIC8, SpecUtils_Det_Falcon5000,
461461
SpecUtils_Det_MicroDetective, SpecUtils_Det_MicroRaider,
462-
SpecUtils_Det_RadiaCode, SpecUtils_Det_Interceptor, SpecUtils_Det_RadHunterNaI,
462+
SpecUtils_Det_RadiaCodeCsI10, SpecUtils_Det_RadiaCodeCsI14, SpecUtils_Det_RadiaCodeGAGG10,
463+
SpecUtils_Det_Raysid,
464+
SpecUtils_Det_Interceptor, SpecUtils_Det_RadHunterNaI,
463465
SpecUtils_Det_RadHunterLaBr3, SpecUtils_Det_Rsi701, SpecUtils_Det_Rsi705,
464466
SpecUtils_Det_AvidRsi, SpecUtils_Det_OrtecRadEagleNai, SpecUtils_Det_OrtecRadEagleCeBr2Inch,
465467
SpecUtils_Det_OrtecRadEagleCeBr3Inch, SpecUtils_Det_OrtecRadEagleLaBr, SpecUtils_Det_Sam940LaBr3,
466468
SpecUtils_Det_Sam940, SpecUtils_Det_Sam945, SpecUtils_Det_Srpm210,
467469
SpecUtils_Det_RIIDEyeNaI, SpecUtils_Det_RIIDEyeLaBr, SpecUtils_Det_RadSeekerNaI,
468470
SpecUtils_Det_RadSeekerLaBr, SpecUtils_Det_VerifinderNaI, SpecUtils_Det_VerifinderLaBr,
469-
SpecUtils_Det_KromekD3S, SpecUtils_Det_Fulcrum, SpecUtils_Det_Fulcrum40h, SpecUtils_Det_Sam950,
471+
SpecUtils_Det_KromekD3S, SpecUtils_Det_KromekD5, SpecUtils_Det_KromekGR1,
472+
SpecUtils_Det_Fulcrum, SpecUtils_Det_Fulcrum40h, SpecUtils_Det_Sam950,
470473
SpecUtils_Det_Unknown
471474
};//enum SpecUtils_DetectorType
472475

bindings/python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ python3 -m venv my_venv
7676
source my_venv/bin/activate # Windows PowerShell: .\my_venv\Scripts\Activate.ps1
7777
7878
# Compile and install the bindings
79-
pip install SpecUtils/bindings/python
79+
pip install --use-feature=in-tree-build SpecUtils/bindings/python
8080
8181
# Use the package
8282
python

bindings/python/SpecFile_py.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,8 @@ py::enum_<SpecUtils::DetectorType>(m, "DetectorType")
13641364
.value("IdentiFinderNG", SpecUtils::DetectorType::IdentiFinderNG)
13651365
.value("IdentiFinderLaBr3", SpecUtils::DetectorType::IdentiFinderLaBr3)
13661366
.value("IdentiFinderTungsten", SpecUtils::DetectorType::IdentiFinderTungsten)
1367+
.value("IdentiFinderR425NaI", SpecUtils::DetectorType::IdentiFinderR425NaI)
1368+
.value("IdentiFinderR425LaBr", SpecUtils::DetectorType::IdentiFinderR425LaBr)
13671369
.value("IdentiFinderR500NaI", SpecUtils::DetectorType::IdentiFinderR500NaI)
13681370
.value("IdentiFinderR500LaBr", SpecUtils::DetectorType::IdentiFinderR500LaBr)
13691371
.value("IdentiFinderUnknown", SpecUtils::DetectorType::IdentiFinderUnknown)
@@ -1376,7 +1378,9 @@ py::enum_<SpecUtils::DetectorType>(m, "DetectorType")
13761378
.value("Falcon5000", SpecUtils::DetectorType::Falcon5000)
13771379
.value("MicroDetective", SpecUtils::DetectorType::MicroDetective)
13781380
.value("MicroRaider", SpecUtils::DetectorType::MicroRaider)
1379-
.value("RadiaCode", SpecUtils::DetectorType::RadiaCode)
1381+
.value("RadiaCodeCsI10", SpecUtils::DetectorType::RadiaCodeCsI10)
1382+
.value("RadiaCodeCsI14", SpecUtils::DetectorType::RadiaCodeCsI14)
1383+
.value("RadiaCodeGAGG10", SpecUtils::DetectorType::RadiaCodeGAGG10)
13801384
.value("Interceptor", SpecUtils::DetectorType::Interceptor)
13811385
.value("RadHunterNaI", SpecUtils::DetectorType::RadHunterNaI)
13821386
.value("RadHunterLaBr3", SpecUtils::DetectorType::RadHunterLaBr3)
@@ -1405,8 +1409,7 @@ py::enum_<SpecUtils::DetectorType>(m, "DetectorType")
14051409
.value("KromekGR1", SpecUtils::DetectorType::KromekGR1)
14061410
.value("KromekD5", SpecUtils::DetectorType::KromekD5)
14071411
.value("Unknown", SpecUtils::DetectorType::Unknown);
1408-
1409-
1412+
14101413

14111414
py::enum_<SpecUtils::SpectrumType>(m, "SpectrumType")
14121415
.value("Foreground", SpecUtils::SpectrumType::Foreground)

src/SpecFile.cpp

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,9 @@ const std::string &detectorTypeToString( const DetectorType type )
14001400
static const string sm_UnknownDetectorStr = "Unknown";
14011401
static const string sm_MicroDetectiveDetectorStr = "MicroDetective";
14021402
static const string sm_MicroRaiderDetectorStr = "MicroRaider";
1403-
static const string sm_RadiaCodeDetectorStr = "RadiaCode-102";
1403+
static const string sm_RadiaCode10XDetectorStr = "RadiaCode-10X";
1404+
static const string sm_RadiaCode110DetectorStr = "RadiaCode-110";
1405+
static const string sm_RadiaCode103GDetectorStr = "RadiaCode-103G";
14041406
static const string sm_InterceptorStr = "Interceptor";
14051407
static const string sm_Sam940DetectorStr = "SAM940";
14061408
static const string sm_Sam940Labr3DetectorStr = "SAM940LaBr3";
@@ -1432,7 +1434,7 @@ const std::string &detectorTypeToString( const DetectorType type )
14321434

14331435
// GN3, InSpector 1000 LaBr3, Pager-S, SAM-Eagle-LaBr, GR130, SAM-Eagle-NaI-3x3
14341436
// InSpector 1000 NaI, RadPack, SpiR-ID LaBr3, Interceptor, Radseeker, SpiR-ID NaI
1435-
// GR135Plus, LRM, Raider, HRM, LaBr3PNNL, Transpec, Falcon 5000, Ranger, RadiaCode-102
1437+
// GR135Plus, LRM, Raider, HRM, LaBr3PNNL, Transpec, Falcon 5000, Ranger, RadiaCode-10X
14361438
// MicroDetective, FieldSpec, IdentiFINDER-NG, SAM-935, NaI 3x3, SAM-Eagle-LaBr3
14371439

14381440
switch( type )
@@ -1478,8 +1480,12 @@ const std::string &detectorTypeToString( const DetectorType type )
14781480
return sm_MicroDetectiveDetectorStr;
14791481
case DetectorType::MicroRaider:
14801482
return sm_MicroRaiderDetectorStr;
1481-
case DetectorType::RadiaCode:
1482-
return sm_RadiaCodeDetectorStr;
1483+
case DetectorType::RadiaCodeCsI10:
1484+
return sm_RadiaCode10XDetectorStr;
1485+
case DetectorType::RadiaCodeCsI14:
1486+
return sm_RadiaCode110DetectorStr;
1487+
case DetectorType::RadiaCodeGAGG10:
1488+
return sm_RadiaCode103GDetectorStr;
14831489
case DetectorType::Interceptor:
14841490
return sm_InterceptorStr;
14851491
case DetectorType::Sam940:
@@ -5619,7 +5625,10 @@ void SpecFile::cleanup_after_load( const unsigned int flags )
56195625
&& meas->real_time() > 0.00000001
56205626
&& !meas->derived_data_properties() //make sure not derived data
56215627
&& ((meas->real_time() < 15.0) //20181108: some search systems will take one spectra every like ~10 seconds
5622-
|| ((detector_type_ == SpecUtils::DetectorType::RadiaCode) // Radiacode detectors can take like 30 second spectra
5628+
// Radiacode detectors can take spectra over many seconds or minutes
5629+
|| (((detector_type_ == SpecUtils::DetectorType::RadiaCodeCsI10)
5630+
|| (detector_type_ == SpecUtils::DetectorType::RadiaCodeCsI10)
5631+
|| (detector_type_ == SpecUtils::DetectorType::RadiaCodeGAGG10))
56235632
&& (meas->real_time() < 125.0)) ) )
56245633
{
56255634
++pt_num_items;
@@ -6847,12 +6856,28 @@ void SpecFile::set_detector_type_from_other_info()
68476856
detector_type_ = DetectorType::Fulcrum;
68486857
return;
68496858
}//if( icontains(instrument_model_, "Fulcrum") )
6850-
6859+
6860+
if( icontains(instrument_model_, "RadiaCode-103G") )
6861+
{
6862+
if( manufacturer_.empty() )
6863+
manufacturer_ = "Scan-Electronics";
6864+
detector_type_ = SpecUtils::DetectorType::RadiaCodeGAGG10;
6865+
return;
6866+
}
6867+
6868+
if( icontains(instrument_model_, "RadiaCode-110") )
6869+
{
6870+
if( manufacturer_.empty() )
6871+
manufacturer_ = "Scan-Electronics";
6872+
detector_type_ = SpecUtils::DetectorType::RadiaCodeCsI14;
6873+
return;
6874+
}
6875+
68516876
if( icontains(instrument_model_, "RadiaCode") )
68526877
{
68536878
if( manufacturer_.empty() )
68546879
manufacturer_ = "Scan-Electronics";
6855-
detector_type_ = SpecUtils::DetectorType::RadiaCode;
6880+
detector_type_ = SpecUtils::DetectorType::RadiaCodeCsI10;
68566881
return;
68576882
}
68586883

src/SpecFile_n42.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,17 @@ std::string determine_gamma_detector_kind_code( const SpecUtils::SpecFile &sf )
580580
break;
581581

582582
case SpecUtils::DetectorType::KromekD3S:
583-
case SpecUtils::DetectorType::RadiaCode:
583+
case SpecUtils::DetectorType::RadiaCodeCsI10:
584+
case SpecUtils::DetectorType::RadiaCodeCsI14:
584585
case SpecUtils::DetectorType::Raysid:
585586
det_kind = "CsI";
586587
break;
587588

589+
// GAGG (gadolinium aluminum gallium garnet) is not defined in my copy of N42, but neither is CLLBC
590+
case SpecUtils::DetectorType::RadiaCodeGAGG10:
591+
det_kind = "GAGG";
592+
break;
593+
588594
case SpecUtils::DetectorType::KromekD5:
589595
det_kind = "CLLBC";
590596

src/SpecFile_radiacode.cpp

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,36 @@ namespace
6363

6464
return static_cast<float>(live_time);
6565
};//float estimate_radiacode102_live_time( const float real_time, const double total_counts )
66+
67+
68+
bool guess_detector_from_radiacode_model( const std::string &instrument_model,
69+
std::string &instrument_type,
70+
std::string &manufacturer,
71+
SpecUtils::DetectorType &detector_type )
72+
{
73+
if( SpecUtils::icontains( instrument_model, "RadiaCode-103G" ) ) {
74+
instrument_type = "Spectroscopic Personal Radiation Detector";
75+
manufacturer = "Scan-Electronics";
76+
detector_type = SpecUtils::DetectorType::RadiaCodeGAGG10;
77+
return true;
78+
} else if( SpecUtils::icontains( instrument_model, "RadiaCode-110" ) ) {
79+
instrument_type = "Spectroscopic Personal Radiation Detector";
80+
manufacturer = "Scan-Electronics";
81+
detector_type = SpecUtils::DetectorType::RadiaCodeCsI14;
82+
return true;
83+
} else if( SpecUtils::icontains( instrument_model, "RadiaCode-" ) ) {
84+
instrument_type = "Spectroscopic Personal Radiation Detector";
85+
manufacturer = "Scan-Electronics";
86+
detector_type = SpecUtils::DetectorType::RadiaCodeCsI10;
87+
return true;
88+
}
89+
90+
return false;
91+
} // bool SpecFile::guess_detector_from_radiacode_model(...)
6692
}//namespace
6793

68-
namespace SpecUtils {
94+
namespace SpecUtils
95+
{
6996

7097
bool SpecFile::load_radiacode_file(const std::string& filename) {
7198
#ifdef _WIN32
@@ -438,17 +465,9 @@ bool SpecFile::load_from_radiacode(std::istream& input) {
438465
}
439466
}//if( background_node )
440467
}//XML_FOREACH_CHILD( n_root, data_list_node, "ResultData" )
441-
442-
if( icontains( instrument_model_, "RadiaCode-" ) )
443-
{
444-
instrument_type_ = "Spectroscopic Personal Radiation Detector";
445-
manufacturer_ = "Scan-Electronics";
446-
detector_type_ = SpecUtils::DetectorType::RadiaCode;
447-
}else
448-
{
449-
// File probably made with BecqMoni
450-
}
451-
468+
469+
guess_detector_from_radiacode_model( instrument_model_, instrument_type_, manufacturer_, detector_type_ );
470+
452471
cleanup_after_load();
453472
}catch( std::exception & )
454473
{
@@ -558,7 +577,7 @@ bool SpecFile::load_from_radiacode_spectrogram( std::istream& input )
558577
uint64_t last_timestamp = timestamp;
559578
size_t skipped_lines = 0, total_lines = 0;
560579
string line;
561-
bool line_warning = true;
580+
bool line_warning = true;
562581
while( safe_get_line(input, line, 64*1024) )
563582
{
564583
total_lines += 1;
@@ -724,10 +743,8 @@ bool SpecFile::load_from_radiacode_spectrogram( std::istream& input )
724743
if( !comment.empty() )
725744
remarks_.push_back( "Comment: " + comment );
726745

727-
instrument_type_ = "Spectroscopic Personal Radiation Detector";
728-
manufacturer_ = "Scan-Electronics";
729-
detector_type_ = SpecUtils::DetectorType::RadiaCode;
730-
746+
guess_detector_from_radiacode_model( instrument_model_, instrument_type_, manufacturer_, detector_type_ );
747+
731748
cleanup_after_load();
732749
}catch( std::exception & )
733750
{

src/SpecFile_spc.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,9 @@ bool SpecFile::write_binary_spc( std::ostream &output,
13881388
case DetectorType::Raysid:
13891389
case DetectorType::KromekGR1:
13901390
case DetectorType::KromekD5:
1391-
case DetectorType::RadiaCode:
1391+
case DetectorType::RadiaCodeCsI10:
1392+
case DetectorType::RadiaCodeCsI14:
1393+
case DetectorType::RadiaCodeGAGG10:
13921394
case DetectorType::Fulcrum:
13931395
case DetectorType::Fulcrum40h:
13941396
case DetectorType::Sam950:

0 commit comments

Comments
 (0)