fbgsense 0.1
Generic FBG spectrum analysis tool
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
spectrum Class Reference

Data structure providing access to the implemented method. More...

#include <spectrum.h>

Inheritance diagram for spectrum:
spectrum_file spectrum_sm125

Public Member Functions

 spectrum (size_t storage, size_t samples)
 
 spectrum (size_t samples)
 
void set_filter (filter_type type)
 Set the filter that will remove noise from the spectrum. The default is filter_type::FFT.
 
void set_filter (processor< fbgsense::filtering::filter > &&type)
 Set custom filtering processor.
 
void set_detection_method (detection_type type)
 Set the detection method that will find potential peaks. The default method is detection_type::LOCAL_MAXIMA.
 
void set_detection_method (processor< fbgsense::detection::detection_method > &&type)
 Set custom detection method processor.
 
void set_segmentation_method (segment_type type)
 Set the method that will segment the spectrum into peak regions. The default method is segment_type::LOCAL_MINIMA.
 
void set_detection_method (processor< fbgsense::segmentation::segmentation_method > &&type)
 Set custom segmentation method processor.
 
spectrum_unit_t * get_wavelengths ()
 Get wavelength array. This array is shared across all intensities in the spectrum.
 
spectrum_unit_t * get_source_intensities (channel_t channel)
 Get source intensities array for the specified channel.
 
spectrum_unit_t * get_filtered_intensities (channel_t channel)
 Get filtered intensities array for the specified channel.
 
spectrum_state get_spectrum_state (channel_t channel)
 Get internal data structures for the given channel.
 
size_t get_storage_size ()
 Get size of physical storage array.
 
size_t get_samples_count ()
 Get number of samples.
 
minmax_t get_wavelength_bounds ()
 Get lowest and highest wavelength value.
 
bool is_noise (channel_t channel)
 Checks if the signal intensity is within reasonable range.
 
void recalculate (channel_t channel)
 Find global extremas.
 
void filter (channel_t channel, std::initializer_list< parameter_t > params)
 Filtering process.
 
void detect (channel_t channel, std::initializer_list< parameter_t > params)
 Peak detection process.
 
std::vector< region_tsegment (channel_t channel, std::initializer_list< parameter_t > params)
 Find peak regions of interest (ROI).
 
peak fit (channel_t channel, fit_settings_t fitSettings, region_t region)
 Fit a function on the specified dataset using least squares technique.
 
bool perform (channel_t channel, std::initializer_list< parameter_t > filteringParams, std::initializer_list< parameter_t > detectionParams, std::initializer_list< parameter_t > segmentationParams, fit_settings_t fitSettings)
 Perform every step of calculation on the specific channel. More...
 
void perform (std::initializer_list< parameter_t > filteringParams, std::initializer_list< parameter_t > detectionParams, std::initializer_list< parameter_t > segmentationParams, fit_settings_t fitSettings)
 Perform every step of calculation for all channels.
 
void clean ()
 Clear found peaks.
 
void print (std::ostream &s, std::string delimiter="\t")
 Print peaks to the specified stream.
 
std::vector< peakget_peaks ()
 Get flattened list of peaks.
 
std::vector< peakget_peaks (channel_t channel)
 Get peaks of specific channel.
 
spectrum_point_t get_spectrum_point (channel_t channel, size_t index)
 Get a single point from spectrum channel in form of a tuple.
 

Static Public Member Functions

static constexpr size_t to_index (channel_t channel)
 
static channel_t get_channel_count ()
 Get number of channels.
 

Protected Attributes

size_t m_samples { 0 }
 
size_t m_storage { 0 }
 
spectrum_unit_t * m_indices
 
spectrum_unit_t * m_wavelengths
 
spectrum_unit_t * m_intensities [spectrum_max_channels]
 
spectrum_unit_t * m_filtered_intensities [spectrum_max_channels]
 
std::span< complex_t > m_freq [spectrum_max_channels]
 
std::span< derivation_tm_derivation [spectrum_max_channels]
 
minmax_t m_extremas [spectrum_max_channels]
 
std::vector< peakm_peaks [spectrum_max_channels]
 
std::unique_ptr< fbgsense::filtering::filterm_filter
 
std::unique_ptr< fbgsense::detection::detection_methodm_detection_method
 
std::unique_ptr< fbgsense::segmentation::segmentation_methodm_segmentation_method
 

Detailed Description

Data structure providing access to the implemented method.

Member Function Documentation

◆ perform()

bool spectrum::perform ( channel_t  channel,
std::initializer_list< parameter_t >  filteringParams,
std::initializer_list< parameter_t >  detectionParams,
std::initializer_list< parameter_t >  segmentationParams,
fit_settings_t  fitSettings 
)

Perform every step of calculation on the specific channel.

Returns
true when all steps are completed, false if the spectrum contains only noise (steps have been skipped)

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