sas.sascalc.corfunc package

Submodules

sas.sascalc.corfunc.calculation_data module

class sas.sascalc.corfunc.calculation_data.EntryListEnum(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum with a helper method that gives a string containing all the options

classmethod options() str
class sas.sascalc.corfunc.calculation_data.ExtrapolationInteractionState(extrapolation_parameters: ExtrapolationParameters, working_line_id: int | None = None, dragging_line_position: float | None = None)

Bases: object

Represents the state of the slider used to control extrapolation parameters

Contains extrapolation parameters along with the representation of the hover state.

dragging_line_position: float | None = None
extrapolation_parameters: ExtrapolationParameters
working_line_id: int | None = None
class sas.sascalc.corfunc.calculation_data.ExtrapolationParameters(data_q_min: float, point_1: float, point_2: float, point_3: float, data_q_max: float)

Bases: NamedTuple

Represents the parameters defining extrapolation

data_q_max: float

Alias for field number 4

data_q_min: float

Alias for field number 0

point_1: float

Alias for field number 1

point_2: float

Alias for field number 2

point_3: float

Alias for field number 3

class sas.sascalc.corfunc.calculation_data.Fittable(data: T | None = None, allow_fit: bool = True)

Bases: Generic[T]

Container for parameters that can be fitted by the corfunc perspective

allow_fit: bool
clear()
data: T | None
class sas.sascalc.corfunc.calculation_data.GuinierData(A: float, B: float)

Bases: object

Parameters for a Guinier model

A: float
B: float
class sas.sascalc.corfunc.calculation_data.LamellarParameters(long_period: float, interface_thickness: float, hard_block_thickness: float, soft_block_thickness: float, core_thickness: float, polydispersity_ryan: float, polydispersity_stribeck: float, local_crystallinity: float)

Bases: object

Lamellar parameters

core_thickness: float
hard_block_thickness: float
interface_thickness: float
local_crystallinity: float
long_period: float
polydispersity_ryan: float
polydispersity_stribeck: float
soft_block_thickness: float
class sas.sascalc.corfunc.calculation_data.LongPeriodMethod(*values)

Bases: EntryListEnum

Methods for estimating the long period

DOUBLE_MIN = 'double-min'
MAX = 'max'
class sas.sascalc.corfunc.calculation_data.PorodData(K: float, sigma: float)

Bases: object

Parameters for a Porod model

K: float
sigma: float
class sas.sascalc.corfunc.calculation_data.SettableExtrapolationParameters(point_1: float, point_2: float, point_3: float)

Bases: object

Extrapolation parameters that can be set by the user

point_1: float
point_2: float
point_3: float
class sas.sascalc.corfunc.calculation_data.SupplementaryParameters(tangent_point_z: float, tangent_point_gamma: float, tangent_gradient: float, first_minimum_z: float, first_minimum_gamma: float, first_maximum_z: float, first_maximum_gamma: float, hard_block_z: float, hard_block_gamma: float, interface_z: float, core_z: float, z_range: tuple[float, float], gamma_range: tuple[float, float])

Bases: object

Parameters used for drawing the diagram

core_z: float
first_maximum_gamma: float
first_maximum_z: float
first_minimum_gamma: float
first_minimum_z: float
gamma_range: tuple[float, float]
hard_block_gamma: float
hard_block_z: float
interface_z: float
tangent_gradient: float
tangent_point_gamma: float
tangent_point_z: float
z_range: tuple[float, float]
class sas.sascalc.corfunc.calculation_data.TangentMethod(*values)

Bases: EntryListEnum

Methods for estimating the tangent

HALF_MIN = 'half-min'
INFLECTION = 'inflection'
class sas.sascalc.corfunc.calculation_data.TransformedData(gamma_1: Data1D, gamma_3: Data1D, idf: Data1D)

Bases: object

Container for the data that is returned by the corfunc transform method

gamma_1: Data1D
gamma_3: Data1D
idf: Data1D

sas.sascalc.corfunc.corfunc_calculator module

This module implements corfunc

exception sas.sascalc.corfunc.corfunc_calculator.CalculationError(msg: str)

Bases: Exception

Error doing calculation

class sas.sascalc.corfunc.corfunc_calculator.CorfuncCalculator(data: Data1D | None = None, extrapolation_parameters: SettableExtrapolationParameters | None = None, long_period_method: LongPeriodMethod | None = None, tangent_method: TangentMethod | None = None)

Bases: object

property background
static calculate_guinier_parameters(q, I)

Fit the Guinier region of the curve using linear least squares

static calculate_porod_parameters(q, I)

Fit the Porod region of the curve

property data: Data1D | None
property extrapolated
property extrapolation_function: Callable | None
property extrapolation_parameters: ExtrapolationParameters | None
property fit_background
property fit_guinier
property fit_porod
property guinier
static guinier_function(A, B, background)
property lamellar_parameters: LamellarParameters
property min_extrapolated: float | None
property porod
static porod_fitting_function(q, K, sigma, background)

Equation for the Porod region of the data

static porod_fitting_function_expected(q, K, sigma, background)

Expected value function used for fitting Porod region (has a q^2 weighting)

static porod_fitting_function_observed(q, I)

Observed value function used for fitting Porod region

static porod_function(K, sigma, background)
property q_range: tuple[float, float]
reset_calculated_values()

Resets the calculated values, but does not clear the data or reset the user specified parameters

run()

Execute the calculation

property supplementary_parameters: SupplementaryParameters | None
property transformed
sas.sascalc.corfunc.corfunc_calculator.extract_lamellar_parameters(data: Data1D, guinier_to_data_transition_right: float, data_to_porod_transition_left: float, data_to_porod_transition_right: float, long_period_method: LongPeriodMethod | None = None, tangent_method: TangentMethod | None = None)

Extract lamellar parameters from data using the corfunc calculator

Parameters:
  • data – Data1D object containing QSpace data

  • guinier_to_data_transition_right – Q value at which to end the extrapolation from Guiner to data

  • data_to_porod_transition_left – Q value at which to begin the extrapolation from data to Porod

  • data_to_porod_transition_right – Q value at which to end the extrapolation from data to Porod

  • long_period_method – LongPeriodMethod enum value specifying how to calculate the long period (None autodetects)

  • tangent_method – TangentMethod enum value specifying how to calculate the long period (None autodetects)

Returns:

LamellarParameters object with calculated lamellar parameters

sas.sascalc.corfunc.smoothing module

class sas.sascalc.corfunc.smoothing.Cache(x, y)

Bases: tuple

x

Alias for field number 0

y

Alias for field number 1

class sas.sascalc.corfunc.smoothing.SmoothJoin(left_hand_function: Callable[[ndarray | float | int], ndarray | float | int], right_hand_function: Callable[[ndarray | float | int], ndarray | float | int], start: float, stop: float)

Bases: object

Function that merges two functions, one on the left (small x), one on the right (high x) with a transition region inbetween, specified by [start, stop]

Parameters:
  • left_hand_function – The first curve to interpolate

  • right_hand_function – The second curve to interpolate

  • start – The value at which to start the interpolation

  • stop – The value at which to stop the interpolation

sas.sascalc.corfunc.smoothing.main()
sas.sascalc.corfunc.smoothing.show_smoothing_function()

Local sanity-check plots for the joiner

sas.sascalc.corfunc.transform_thread module

class sas.sascalc.corfunc.transform_thread.FourierThread(raw_data, extrapolated_data, bg, updatefn=None, completefn=None)

Bases: CalcThread

check_if_cancelled()
compute()

Perform a work unit. The subclass will provide details of the arguments.

class sas.sascalc.corfunc.transform_thread.HilbertThread(raw_data, extrapolated_data, bg, updatefn=None, completefn=None)

Bases: CalcThread

compute()

Perform a work unit. The subclass will provide details of the arguments.

sas.sascalc.corfunc.vectorisation module

sas.sascalc.corfunc.vectorisation.assure_vectorised_argument(f: Callable)

Allow arguments to a function mapping numpy vectors that would otherwise strictly require numpy vectors, to accept and return floats

Module contents