ScanSamples#
- class cbclib.ScanSamples(items=[])[source]#
A collection of sample
cbclib.Sampleobjects. Provides an interface to import from and exprort to apandas.DataFrametable and a set of dictionary methods.- detector_to_kout(x, y, setup, idxs, rec_vec=None, num_threads=1)[source]#
Project detector coordinates
(x, y)to the output wave-vectors space originating from the samples’ locations.- Parameters
x (
ndarray) – A set of x coordinates.y (
ndarray) – A set of y coordinates.setup (
ScanSetup) – Experimental setup.idxs (
ndarray) – Sample indices.rec_vec (
Optional[ndarray]) – A set of scattering vectors corresponding to the detector points.num_threads (
int) – Number of threads used in the calculations.
- Return type
- Returns
An array of output wave-vectors.
- find_rotations(from_frames, to_frames)[source]#
Find a rotation that rotates
from_framessamples toto_frames.
- classmethod import_dataframe(df)[source]#
Initialize a new
ScanSamplescontainer with apandas.DataFrametable. The table must contain the following columns:Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz : Rotational matrix.
z : z coordinate [m].
- Parameters
data – A
pandas.DataFrametable.- Return type
- Returns
A new
ScanSamplescontainer.
- kin_to_sample(setup, kin=None, idxs=None, num_threads=1)[source]#
Project incident wave-vectors to the sample planes.
- kout_to_detector(kout, setup, idxs, rec_vec=None, num_threads=1)[source]#
Project output wave-vectors originating from the samples’ locations to the detector plane.
- Parameters
- Return type
- Returns
A tuple of x and y detector coordinates.
- regularise(kernel_bandwidth)[source]#
Regularise sample positions by applying a Gaussian Process with a gaussian kernel bandwidth in the given interval.
- Parameters
kernel_bandwidth (
Tuple[int,int]) – Inverval of gaussian kernel bandwidths to use.- Return type
- Returns
A new
ScanSamplescontainer with regularised sample positions.
- rotate(vectors, idxs, reciprocate=False, num_threads=1)[source]#
Rotate an array of vectors into the samples’ system of coordinates.
- to_dataframe()[source]#
Export the sample object to a
pandas.DataFrametable.- Returns
Rxx, Rxy, Rxz, Ryx, Ryy, Ryz, Rzx, Rzy, Rzz : Rotational matrix.
z : z coordinate [m].
- Return type
A
pandas.DataFrametable with the following columns