Mantid
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
Mantid::DataHandling::BankPulseTimes Class Reference

This class defines the pulse times for a specific bank. More...

#include <BankPulseTimes.h>

Public Member Functions

bool arePulseTimesIncreasing () const
 Threadsafe method to access cached information about sorting.
 
 BankPulseTimes (const std::vector< Mantid::Types::Core::DateAndTime > &times)
 Constructor with vector of DateAndTime.
 
 BankPulseTimes (const std::vector< Mantid::Types::Core::DateAndTime > &times, const std::vector< int > &periodNumbers)
 Constructor with vector of DateAndTime and Period information for testing only.
 
 BankPulseTimes (Nexus::File &file, const std::vector< int > &periodNumbers)
 Constructor with Nexus::File.
 
bool equals (size_t otherNumPulse, const std::string &otherStartTime)
 Equals.
 
std::vector< size_t > getPulseIndices (const Mantid::Types::Core::DateAndTime &start, const Mantid::Types::Core::DateAndTime &stop) const
 Return a vector of [include,exclude) indices into the pulse vectors that are between the start and stop times.
 
std::vector< size_t > getPulseIndices (const std::vector< Mantid::Kernel::TimeInterval > &splitters) const
 
size_t numberOfPulses () const
 The number of pulses being held.
 
int periodNumber (const size_t index) const
 The raw number from the period stored in the logs.
 
const Mantid::Types::Core::DateAndTime & pulseTime (const size_t index) const
 The wall clock time of the pulse.
 

Public Attributes

std::string startTime
 String describing the start time.
 

Static Public Attributes

static const std::string DEFAULT_START_TIME
 Unix epoch used as default epoch when the file does not specify one.
 
static const int FIRST_PERIOD
 Starting number for assigning periods.
 

Private Member Functions

void finalizePeriodNumbers ()
 Ensure that we always have a consistency between nPulses and periodNumbers containers.
 
template<typename ValueType >
void readData (Nexus::File &file, std::size_t numValues, Mantid::Types::Core::DateAndTime &start)
 
void updateStartTime ()
 This determines the start time by finding the minimum value in the array.
 

Private Attributes

bool have_period_info
 
int8_t m_sorting_info
 
std::mutex m_sortingMutex
 
std::vector< int > periodNumbers
 Vector of period numbers corresponding to each pulse.
 
std::vector< Mantid::Types::Core::DateAndTime > pulseTimes
 Array of the pulse times.
 

Detailed Description

This class defines the pulse times for a specific bank.

Since some instruments (ARCS, VULCAN) have multiple preprocessors, this means that some banks have different lists of pulse times.

Definition at line 19 of file BankPulseTimes.h.

Constructor & Destructor Documentation

◆ BankPulseTimes() [1/3]

Mantid::DataHandling::BankPulseTimes::BankPulseTimes ( Nexus::File &  file,
const std::vector< int > &  periodNumbers 
)

Constructor with Nexus::File.

Constructor.

Loads the pulse times from the bank entry of the file

Parameters
file:: nexus file open in the right bank entry
periodNumbers:: Period numbers to index into. Index via frame/pulse

Definition at line 53 of file BankPulseTimes.cpp.

References finalizePeriodNumbers(), NXnumtype::FLOAT64, startTime, and NXnumtype::UINT64.

◆ BankPulseTimes() [2/3]

Mantid::DataHandling::BankPulseTimes::BankPulseTimes ( const std::vector< Mantid::Types::Core::DateAndTime > &  times)

Constructor with vector of DateAndTime.

Constructor.

Build from a vector of date and times. Handles a zero-sized vector

Parameters
times

Definition at line 34 of file BankPulseTimes.cpp.

References finalizePeriodNumbers(), and updateStartTime().

◆ BankPulseTimes() [3/3]

Mantid::DataHandling::BankPulseTimes::BankPulseTimes ( const std::vector< Mantid::Types::Core::DateAndTime > &  times,
const std::vector< int > &  periodNumbers 
)

Constructor with vector of DateAndTime and Period information for testing only.

Definition at line 40 of file BankPulseTimes.cpp.

References finalizePeriodNumbers(), and updateStartTime().

Member Function Documentation

◆ arePulseTimesIncreasing()

bool Mantid::DataHandling::BankPulseTimes::arePulseTimesIncreasing ( ) const

Threadsafe method to access cached information about sorting.

Definition at line 141 of file BankPulseTimes.cpp.

References m_sorting_info, m_sortingMutex, and pulseTimes.

Referenced by getPulseIndices().

◆ equals()

bool Mantid::DataHandling::BankPulseTimes::equals ( size_t  otherNumPulse,
const std::string &  otherStartTime 
)

Equals.

Comparison.

Is this bank's pulse times array the same as another one.

Parameters
otherNumPulse:: number of pulses in the OTHER bank event_time_zero.
otherStartTime:: "offset" attribute of the OTHER bank event_time_zero.
Returns
true if the pulse times are the same and so don't need to be reloaded.

Definition at line 283 of file BankPulseTimes.cpp.

References startTime.

◆ finalizePeriodNumbers()

void Mantid::DataHandling::BankPulseTimes::finalizePeriodNumbers ( )
private

Ensure that we always have a consistency between nPulses and periodNumbers containers.

Definition at line 126 of file BankPulseTimes.cpp.

References have_period_info, periodNumbers, and pulseTimes.

Referenced by BankPulseTimes(), BankPulseTimes(), and BankPulseTimes().

◆ getPulseIndices() [1/2]

std::vector< size_t > Mantid::DataHandling::BankPulseTimes::getPulseIndices ( const Mantid::Types::Core::DateAndTime &  start,
const Mantid::Types::Core::DateAndTime &  stop 
) const

Return a vector of [include,exclude) indices into the pulse vectors that are between the start and stop times.

This is very similar to the behavior of Mantid::Kernel::TimeROI.

This will return an empty vector if all pulse indices are between the start and stop.

Definition at line 200 of file BankPulseTimes.cpp.

References arePulseTimesIncreasing(), index, and pulseTime().

◆ getPulseIndices() [2/2]

std::vector< size_t > Mantid::DataHandling::BankPulseTimes::getPulseIndices ( const std::vector< Mantid::Kernel::TimeInterval > &  splitters) const

Definition at line 259 of file BankPulseTimes.cpp.

◆ numberOfPulses()

size_t Mantid::DataHandling::BankPulseTimes::numberOfPulses ( ) const

The number of pulses being held.

Definition at line 139 of file BankPulseTimes.cpp.

References pulseTimes.

◆ periodNumber()

int Mantid::DataHandling::BankPulseTimes::periodNumber ( const size_t  index) const

The raw number from the period stored in the logs.

Definition at line 154 of file BankPulseTimes.cpp.

References FIRST_PERIOD, have_period_info, index, and periodNumbers.

◆ pulseTime()

const Mantid::Types::Core::DateAndTime & Mantid::DataHandling::BankPulseTimes::pulseTime ( const size_t  index) const

The wall clock time of the pulse.

Definition at line 161 of file BankPulseTimes.cpp.

References index, and pulseTimes.

Referenced by getPulseIndices().

◆ readData()

template<typename ValueType >
void Mantid::DataHandling::BankPulseTimes::readData ( Nexus::File &  file,
std::size_t  numValues,
Mantid::Types::Core::DateAndTime &  start 
)
private

Definition at line 95 of file BankPulseTimes.cpp.

References pulseTimes.

◆ updateStartTime()

void Mantid::DataHandling::BankPulseTimes::updateStartTime ( )
private

This determines the start time by finding the minimum value in the array.

Definition at line 118 of file BankPulseTimes.cpp.

References pulseTimes, and startTime.

Referenced by BankPulseTimes(), and BankPulseTimes().

Member Data Documentation

◆ DEFAULT_START_TIME

const std::string Mantid::DataHandling::BankPulseTimes::DEFAULT_START_TIME
static

Unix epoch used as default epoch when the file does not specify one.

Definition at line 24 of file BankPulseTimes.h.

◆ FIRST_PERIOD

const int Mantid::DataHandling::BankPulseTimes::FIRST_PERIOD
static

Starting number for assigning periods.

Definition at line 22 of file BankPulseTimes.h.

Referenced by periodNumber().

◆ have_period_info

bool Mantid::DataHandling::BankPulseTimes::have_period_info
private

Definition at line 80 of file BankPulseTimes.h.

Referenced by finalizePeriodNumbers(), and periodNumber().

◆ m_sorting_info

int8_t Mantid::DataHandling::BankPulseTimes::m_sorting_info
mutableprivate

Definition at line 82 of file BankPulseTimes.h.

Referenced by arePulseTimesIncreasing().

◆ m_sortingMutex

std::mutex Mantid::DataHandling::BankPulseTimes::m_sortingMutex
mutableprivate

Definition at line 83 of file BankPulseTimes.h.

Referenced by arePulseTimesIncreasing().

◆ periodNumbers

std::vector<int> Mantid::DataHandling::BankPulseTimes::periodNumbers
private

Vector of period numbers corresponding to each pulse.

Definition at line 75 of file BankPulseTimes.h.

Referenced by finalizePeriodNumbers(), and periodNumber().

◆ pulseTimes

std::vector<Mantid::Types::Core::DateAndTime> Mantid::DataHandling::BankPulseTimes::pulseTimes
private

Array of the pulse times.

Definition at line 78 of file BankPulseTimes.h.

Referenced by arePulseTimesIncreasing(), finalizePeriodNumbers(), numberOfPulses(), pulseTime(), readData(), and updateStartTime().

◆ startTime

std::string Mantid::DataHandling::BankPulseTimes::startTime

String describing the start time.

Definition at line 62 of file BankPulseTimes.h.

Referenced by BankPulseTimes(), equals(), and updateStartTime().


The documentation for this class was generated from the following files: