BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
SphericalDetector Class Reference

Description

A detector with coordinate axes along angles phi and alpha.

Inheritance diagram for SphericalDetector:

Public Types

using const_iterator = const SimulationAreaIterator &
 

Public Member Functions

 SphericalDetector ()=default
 
 SphericalDetector (const SphericalDetector &other)
 
 SphericalDetector (size_t n_bin, double width, double phi, double alpha)
 Returns a detector with phi and alpha axes that have equal width and binning. More...
 
 SphericalDetector (size_t n_phi, double phi_min, double phi_max, size_t n_alpha, double alpha_min, double alpha_max)
 Returns a detector with given phi and alpha axes. More...
 
 ~SphericalDetector () override=default
 
std::vector< size_t > active_indices () const
 Returns vector of unmasked detector indices. More...
 
void addDetAxis (const IAxis &axis)
 
void addMask (const IShape2D &shape, bool mask_value=true)
 Adds mask of given shape to the stack of detector masks. The mask value 'true' means that the channel will be excluded from the simulation. The mask which is added last has priority. More...
 
void applyDetectorResolution (Datafield *p_intensity_map) const
 Applies the detector resolution to the given intensity maps. More...
 
OwningVector< IAxis > axesClippedToRegionOfInterest () const
 Returns the axes clipped to the region of interest. If no region of interest is explicitly defined, then the whole detector is taken as "region of interest". More...
 
const IAxis & axis (size_t index) const
 One axis of the complete detector. Any region of interest is not taken into account. More...
 
size_t axisBinIndex (size_t index, size_t selected_axis) const
 Calculate axis index for given global index. More...
 
std::string className () const override
 
SphericalDetectorclone () const override
 
DatafieldcreateDetectorIntensity (const std::vector< std::unique_ptr< DiffuseElement >> &elements) const
 Returns new intensity map with resolution applied, and cropped to ROI if applicable. More...
 
Coords defaultCoords () const override
 Returns default axes units. More...
 
size_t detectorIndexToRegionOfInterestIndex (size_t detectorIndex) const
 
const DetectorMaskdetectorMask () const
 
const IDetectorResolutiondetectorResolution () const
 Returns a pointer to detector resolution object. More...
 
bool hasExplicitRegionOfInterest () const
 True if a region of interest is explicitly set. More...
 
void iterateOverNonMaskedPoints (std::function< void(const_iterator)> func) const
 Iterate over all non-masked points within "region of interest". If no region of interest is explicitly defined, then the whole detector is taken as "region of interest". More...
 
void iterateOverRegionOfInterest (std::function< void(const_iterator)> func) const
 Iterate over all points within "region of interest", no matter whether they are masked or not. If no region of interest is explicitly defined, then the whole detector is taken as "region of interest". More...
 
void maskAll ()
 Put the mask for all detector channels (i.e. exclude whole detector from the analysis) More...
 
std::vector< const INode * > nodeChildren () const override
 
size_t numberOfElements () const
 Returns number of simulation elements. More...
 
ICoordSystem * offspecCoords (IAxis *beamAxis, const Direction &beamDirection) const override
 
size_t rank () const
 Returns number of defined axes. More...
 
std::pair< double, double > regionOfInterestBounds (size_t iAxis) const
 The lower and upper bound of the region of interest. If no region of interest is explicitly defined, then the whole detector is taken as "region of interest". More...
 
size_t regionOfInterestIndexToDetectorIndex (size_t regionOfInterestIndex) const
 Convert an index of the region of interest to an index of the detector. If no region of interest is set, then the index stays unmodified (since ROI == detector area). More...
 
void resetRegionOfInterest ()
 Resets region of interest making whole detector plane available for the simulation. More...
 
CoordSystem2D * scatteringCoords (const Beam &beam) const override
 
void setAnalyzer (R3 direction, double efficiency, double total_transmission)
 Sets the polarization analyzer characteristics of the detector. More...
 
virtual void setDetectorNormal (const Direction &)
 Inits detector with the beam settings. More...
 
void setDetectorParameters (size_t n_x, double x_min, double x_max, size_t n_y, double y_min, double y_max)
 Sets equidistant axes. More...
 
void setDetectorResolution (const IDetectorResolution &p_detector_resolution)
 Sets the detector resolution. More...
 
void setRegionOfInterest (double xlow, double ylow, double xup, double yup)
 Sets rectangular region of interest with lower left and upper right corners defined. More...
 
void setResolutionFunction (const IResolutionFunction2D &resFunc)
 
size_t sizeOfRegionOfInterest () const
 The size of the "Region of Interest". Same as totalSize() if no region of interest has been explicitly set. More...
 
size_t totalSize () const
 Returns total number of pixels. Any region of interest is not taken into account. More...
 

Protected Member Functions

virtual std::pair< double, double > boundsOfExplicitRegionOfInterest (size_t iAxis) const
 Lower and upper bound of one axis of an explicitly set ROI. Return 0/0 if no ROI has been explicitly set. More...
 
void clear ()
 
size_t getGlobalIndex (size_t x, size_t y) const
 Calculate global index from two axis indices. More...
 
virtual size_t sizeOfExplicitRegionOfInterest () const
 Return 0 if no ROI has been explicitly set. Size means number of data points. More...
 

Member Typedef Documentation

◆ const_iterator

using IDetector::const_iterator = const SimulationAreaIterator&
inherited

Constructor & Destructor Documentation

◆ SphericalDetector() [1/4]

SphericalDetector::SphericalDetector ( )
default

◆ SphericalDetector() [2/4]

SphericalDetector::SphericalDetector ( size_t  n_phi,
double  phi_min,
double  phi_max,
size_t  n_alpha,
double  alpha_min,
double  alpha_max 
)

Returns a detector with given phi and alpha axes.

Parameters
n_phinumber of phi-axis bins
phi_minlow edge of first phi-bin
phi_maxupper edge of last phi-bin
n_alphanumber of alpha-axis bins
alpha_minlow edge of first alpha-bin
alpha_maxupper edge of last alpha-bin

◆ SphericalDetector() [3/4]

SphericalDetector::SphericalDetector ( size_t  n_bin,
double  width,
double  phi,
double  alpha 
)

Returns a detector with phi and alpha axes that have equal width and binning.

Parameters
n_binnumber of bins per direction
widthfull width of angular range in phi or alpha
phicentral phi angle
alphacentral alpha angle

◆ SphericalDetector() [4/4]

SphericalDetector::SphericalDetector ( const SphericalDetector other)

◆ ~SphericalDetector()

SphericalDetector::~SphericalDetector ( )
overridedefault

Member Function Documentation

◆ active_indices()

std::vector<size_t> IDetector::active_indices ( ) const
inherited

Returns vector of unmasked detector indices.

◆ addDetAxis()

void IDetector::addDetAxis ( const IAxis &  axis)
inherited

◆ addMask()

void IDetector::addMask ( const IShape2D shape,
bool  mask_value = true 
)
inherited

Adds mask of given shape to the stack of detector masks. The mask value 'true' means that the channel will be excluded from the simulation. The mask which is added last has priority.

Parameters
shapeThe shape of mask (Rectangle, Polygon, Line, Ellipse)
mask_valueThe value of mask

◆ applyDetectorResolution()

void IDetector::applyDetectorResolution ( Datafield p_intensity_map) const
inherited

Applies the detector resolution to the given intensity maps.

◆ axesClippedToRegionOfInterest()

OwningVector<IAxis> IDetector::axesClippedToRegionOfInterest ( ) const
inherited

Returns the axes clipped to the region of interest. If no region of interest is explicitly defined, then the whole detector is taken as "region of interest".

◆ axis()

const IAxis& IDetector::axis ( size_t  index) const
inherited

One axis of the complete detector. Any region of interest is not taken into account.

◆ axisBinIndex()

size_t IDetector::axisBinIndex ( size_t  index,
size_t  selected_axis 
) const
inherited

Calculate axis index for given global index.

◆ boundsOfExplicitRegionOfInterest()

virtual std::pair<double, double> IDetector::boundsOfExplicitRegionOfInterest ( size_t  iAxis) const
protectedvirtualinherited

Lower and upper bound of one axis of an explicitly set ROI. Return 0/0 if no ROI has been explicitly set.

◆ className()

std::string SphericalDetector::className ( ) const
override

◆ clear()

void IDetector::clear ( )
protectedinherited

◆ clone()

SphericalDetector* SphericalDetector::clone ( ) const
overridevirtual

Implements IDetector.

◆ createDetectorIntensity()

Datafield* IDetector::createDetectorIntensity ( const std::vector< std::unique_ptr< DiffuseElement >> &  elements) const
inherited

Returns new intensity map with resolution applied, and cropped to ROI if applicable.

◆ defaultCoords()

Coords SphericalDetector::defaultCoords ( ) const
overridevirtual

Returns default axes units.

Implements IDetector.

◆ detectorIndexToRegionOfInterestIndex()

size_t IDetector::detectorIndexToRegionOfInterestIndex ( size_t  detectorIndex) const
inherited

◆ detectorMask()

const DetectorMask* IDetector::detectorMask ( ) const
inherited

◆ detectorResolution()

const IDetectorResolution* IDetector::detectorResolution ( ) const
inherited

Returns a pointer to detector resolution object.

◆ getGlobalIndex()

size_t IDetector::getGlobalIndex ( size_t  x,
size_t  y 
) const
protectedinherited

Calculate global index from two axis indices.

◆ hasExplicitRegionOfInterest()

bool IDetector::hasExplicitRegionOfInterest ( ) const
inherited

True if a region of interest is explicitly set.

◆ iterateOverNonMaskedPoints()

void IDetector::iterateOverNonMaskedPoints ( std::function< void(const_iterator)>  func) const
inherited

Iterate over all non-masked points within "region of interest". If no region of interest is explicitly defined, then the whole detector is taken as "region of interest".

◆ iterateOverRegionOfInterest()

void IDetector::iterateOverRegionOfInterest ( std::function< void(const_iterator)>  func) const
inherited

Iterate over all points within "region of interest", no matter whether they are masked or not. If no region of interest is explicitly defined, then the whole detector is taken as "region of interest".

◆ maskAll()

void IDetector::maskAll ( )
inherited

Put the mask for all detector channels (i.e. exclude whole detector from the analysis)

◆ nodeChildren()

std::vector<const INode*> IDetector::nodeChildren ( ) const
overrideinherited

◆ numberOfElements()

size_t IDetector::numberOfElements ( ) const
inherited

Returns number of simulation elements.

◆ offspecCoords()

ICoordSystem* SphericalDetector::offspecCoords ( IAxis *  beamAxis,
const Direction beamDirection 
) const
overridevirtual

Implements IDetector.

◆ rank()

size_t IDetector::rank ( ) const
inherited

Returns number of defined axes.

◆ regionOfInterestBounds()

std::pair<double, double> IDetector::regionOfInterestBounds ( size_t  iAxis) const
inherited

The lower and upper bound of the region of interest. If no region of interest is explicitly defined, then the whole detector is taken as "region of interest".

◆ regionOfInterestIndexToDetectorIndex()

size_t IDetector::regionOfInterestIndexToDetectorIndex ( size_t  regionOfInterestIndex) const
inherited

Convert an index of the region of interest to an index of the detector. If no region of interest is set, then the index stays unmodified (since ROI == detector area).

◆ resetRegionOfInterest()

void IDetector::resetRegionOfInterest ( )
inherited

Resets region of interest making whole detector plane available for the simulation.

◆ scatteringCoords()

CoordSystem2D* SphericalDetector::scatteringCoords ( const Beam beam) const
overridevirtual

Implements IDetector.

◆ setAnalyzer()

void IDetector::setAnalyzer ( R3  direction,
double  efficiency,
double  total_transmission 
)
inherited

Sets the polarization analyzer characteristics of the detector.

◆ setDetectorNormal()

virtual void IDetector::setDetectorNormal ( const Direction )
virtualinherited

Inits detector with the beam settings.

Reimplemented in RectangularDetector.

◆ setDetectorParameters()

void IDetector::setDetectorParameters ( size_t  n_x,
double  x_min,
double  x_max,
size_t  n_y,
double  y_min,
double  y_max 
)
inherited

Sets equidistant axes.

◆ setDetectorResolution()

void IDetector::setDetectorResolution ( const IDetectorResolution p_detector_resolution)
inherited

Sets the detector resolution.

◆ setRegionOfInterest()

void IDetector::setRegionOfInterest ( double  xlow,
double  ylow,
double  xup,
double  yup 
)
inherited

Sets rectangular region of interest with lower left and upper right corners defined.

◆ setResolutionFunction()

void IDetector::setResolutionFunction ( const IResolutionFunction2D resFunc)
inherited

◆ sizeOfExplicitRegionOfInterest()

virtual size_t IDetector::sizeOfExplicitRegionOfInterest ( ) const
protectedvirtualinherited

Return 0 if no ROI has been explicitly set. Size means number of data points.

◆ sizeOfRegionOfInterest()

size_t IDetector::sizeOfRegionOfInterest ( ) const
inherited

The size of the "Region of Interest". Same as totalSize() if no region of interest has been explicitly set.

◆ totalSize()

size_t IDetector::totalSize ( ) const
inherited

Returns total number of pixels. Any region of interest is not taken into account.