Sirius  0.0.0
Classes | Enumerations | Functions
sirius::utils Namespace Reference

Classes

class  ConcurrentQueue
 Concurrent queue. More...
 
class  LRUCache
 LRU cache. More...
 

Enumerations

enum  ConcurrentQueueErrorCode { ConcurrentQueueErrorCode::kSuccess = 0, ConcurrentQueueErrorCode::kQueueIsNotActive }
 Enum of concurrent queue error codes. More...
 

Functions

std::error_code make_error_code (ConcurrentQueueErrorCode errc)
 Make an error code from ConcurrentQueueErrorCode enum. More...
 
template<typename SmartPtr >
auto MakeSmartPtrArraySpan (const SmartPtr &smart_ptr, const Size &size)
 Make a GSL span from a smart pointer pointing to an array of data. More...
 
void SetVerbosityLevel (const std::string &level)
 Set verbosity level from string. More...
 
int Gcd (int a, int b)
 Compute Gcd of a and b using C++17: will be replaced with std::gcd. More...
 
void FFTShift2D (const double *data, const Size &size, double *shifted_data)
 FFTShift 2D matrix. More...
 
void IFFTShift2D (const double *data, const Size &size, double *shifted_data)
 IFFTShift 2D matrix. More...
 
void IFFTShift2DUncentered (const double *data, const Size &size, const Point &hot_point, double *shifted_data)
 IFFTShift 2D matrix in which hot point is not centered. More...
 
void FFTShift2DUncentered (const double *data, const Size &size, const Point &hot_point, double *shifted_data)
 FFTShift 2D matrix in which hot point must remain uncentered after shift. More...
 
std::vector< double > ComputeFFTFreq (int n_samples, bool half=true)
 Compute frequencies for which fft will be calculated. More...
 
Size GenerateDyadicSize (const Size &size, const int res_in, const Size &padding_size)
 Rounds the parameters so log2(param) is an int. More...
 
Size GenerateZoomCompliantSize (const Size &size, const ZoomRatio &zoom_r)
 Resize given dimensions so it matches with given zoom ratio. More...
 
void CreateMeshgrid (int x_min, int x_max, int y_min, int y_max, std::vector< int > &xx, std::vector< int > &yy)
 Create coordinates vector. More...
 

Enumeration Type Documentation

◆ ConcurrentQueueErrorCode

Enum of concurrent queue error codes.

Enumerator
kSuccess 

success

kQueueIsNotActive 

queue is not active error

Function Documentation

◆ ComputeFFTFreq()

std::vector<double> sirius::utils::ComputeFFTFreq ( int  n_samples,
bool  half = true 
)

Compute frequencies for which fft will be calculated.

Parameters
n_sampleswidth of the spatial signal (expected to be odd)
halfdecide to return only half the frequencies
Returns
frequencies to be calculated

◆ CreateMeshgrid()

void sirius::utils::CreateMeshgrid ( int  x_min,
int  x_max,
int  y_min,
int  y_max,
std::vector< int > &  xx,
std::vector< int > &  yy 
)

Create coordinates vector.

Parameters
x_minbeginning of x axis
x_maxend of x axis (x_max is excluded from the interval)
y_minbeginning of y axis
y_maxend of y axis (y_max is excluded from the interval)
xxoutput 2d x grid
yyoutput 2d y grid

◆ FFTShift2D()

void sirius::utils::FFTShift2D ( const double *  data,
const Size size,
double *  shifted_data 
)

FFTShift 2D matrix.

◆ FFTShift2DUncentered()

void sirius::utils::FFTShift2DUncentered ( const double *  data,
const Size size,
const Point hot_point,
double *  shifted_data 
)

FFTShift 2D matrix in which hot point must remain uncentered after shift.

Parameters
datainput data
sizedimensions of the image to be shifted
hot_pointhot point coordinates
shifted_dataoutput data

◆ Gcd()

int sirius::utils::Gcd ( int  a,
int  b 
)

Compute Gcd of a and b using C++17: will be replaced with std::gcd.

◆ GenerateDyadicSize()

Size sirius::utils::GenerateDyadicSize ( const Size size,
const int  res_in,
const Size padding_size 
)

Rounds the parameters so log2(param) is an int.

Parameters
sizesize to be resized
res_inzoom coefficient that will be applied to the fft
padding_sizesize of the margins
Returns
new size

◆ GenerateZoomCompliantSize()

Size sirius::utils::GenerateZoomCompliantSize ( const Size size,
const ZoomRatio zoom_r 
)

Resize given dimensions so it matches with given zoom ratio.

Parameters
sizesize to be resized
zoom_rzoom ratio
Returns
zoom compliant sizes

◆ IFFTShift2D()

void sirius::utils::IFFTShift2D ( const double *  data,
const Size size,
double *  shifted_data 
)

IFFTShift 2D matrix.

◆ IFFTShift2DUncentered()

void sirius::utils::IFFTShift2DUncentered ( const double *  data,
const Size size,
const Point hot_point,
double *  shifted_data 
)

IFFTShift 2D matrix in which hot point is not centered.

Parameters
datainput data
sizedimensions of the image to be shifted
hot_pointhot point coordinates
shifted_dataoutput data

◆ make_error_code()

std::error_code sirius::utils::make_error_code ( ConcurrentQueueErrorCode  errc)

Make an error code from ConcurrentQueueErrorCode enum.

Parameters
errcerror code
Returns
Generated error code

◆ MakeSmartPtrArraySpan()

template<typename SmartPtr >
auto sirius::utils::MakeSmartPtrArraySpan ( const SmartPtr &  smart_ptr,
const Size size 
)

Make a GSL span from a smart pointer pointing to an array of data.

Parameters
smart_ptrsmart pointer to array to wrap as span
sizesize of the array
Returns
span view of the array

◆ SetVerbosityLevel()

void sirius::utils::SetVerbosityLevel ( const std::string &  level)

Set verbosity level from string.

Parameters
levelverbosity level: trace,debug,info,warn,error,critical,off