sas.sascalc.corfunc package

Submodules

sas.sascalc.corfunc.corfunc_calculator module

This module implements corfunc

class sas.sascalc.corfunc.corfunc_calculator.CorfuncCalculator(data=None, lowerq=None, upperq=None, scale=1)[source]

Bases: object

class _Interpolator(f, g, start, stop)[source]

Bases: object

Interpolates between curve f and curve g over the range start:stop and caches the result of the function when it’s called

Parameters:
  • f – The first curve to interpolate

  • g – The second curve to interpolate

  • start – The value at which to start the interpolation

  • stop – The value at which to stop the interpolation

__call__(x)[source]

Call self as a function.

__dict__ = mappingproxy({'__module__': 'sas.sascalc.corfunc.corfunc_calculator', '__doc__': "\n        Interpolates between curve f and curve g over the range start:stop and\n        caches the result of the function when it's called\n\n        :param f: The first curve to interpolate\n        :param g: The second curve to interpolate\n        :param start: The value at which to start the interpolation\n        :param stop: The value at which to stop the interpolation\n        ", '__init__': <function CorfuncCalculator._Interpolator.__init__>, '__call__': <function CorfuncCalculator._Interpolator.__call__>, '_smoothed_function': <function CorfuncCalculator._Interpolator._smoothed_function>, '__dict__': <attribute '__dict__' of '_Interpolator' objects>, '__weakref__': <attribute '__weakref__' of '_Interpolator' objects>, '__annotations__': {}})
__doc__ = "\n        Interpolates between curve f and curve g over the range start:stop and\n        caches the result of the function when it's called\n\n        :param f: The first curve to interpolate\n        :param g: The second curve to interpolate\n        :param start: The value at which to start the interpolation\n        :param stop: The value at which to stop the interpolation\n        "
__init__(f, g, start, stop)[source]
__module__ = 'sas.sascalc.corfunc.corfunc_calculator'
__weakref__

list of weak references to the object (if defined)

_smoothed_function(x)[source]
__dict__ = mappingproxy({'__module__': 'sas.sascalc.corfunc.corfunc_calculator', '_Interpolator': <class 'sas.sascalc.corfunc.corfunc_calculator.CorfuncCalculator._Interpolator'>, '__init__': <function CorfuncCalculator.__init__>, 'set_data': <function CorfuncCalculator.set_data>, 'compute_background': <function CorfuncCalculator.compute_background>, 'compute_extrapolation': <function CorfuncCalculator.compute_extrapolation>, 'compute_transform': <function CorfuncCalculator.compute_transform>, 'transform_isrunning': <function CorfuncCalculator.transform_isrunning>, 'stop_transform': <function CorfuncCalculator.stop_transform>, 'extract_parameters': <function CorfuncCalculator.extract_parameters>, '_porod': <function CorfuncCalculator._porod>, '_fit_guinier': <function CorfuncCalculator._fit_guinier>, '_fit_porod': <function CorfuncCalculator._fit_porod>, '_fit_data': <function CorfuncCalculator._fit_data>, '__dict__': <attribute '__dict__' of 'CorfuncCalculator' objects>, '__weakref__': <attribute '__weakref__' of 'CorfuncCalculator' objects>, '__doc__': None, '__annotations__': {}})
__doc__ = None
__init__(data=None, lowerq=None, upperq=None, scale=1)[source]

Initialize the class.

Parameters:
  • data – Data of the type DataLoader.Data1D

  • lowerq – The Q value to use as the boundary for Guinier extrapolation

  • upperq – A tuple of the form (lower, upper). Values between lower and upper will be used for Porod extrapolation

  • scale – Scaling factor for I(q)

__module__ = 'sas.sascalc.corfunc.corfunc_calculator'
__weakref__

list of weak references to the object (if defined)

_fit_data(q, iq)[source]

Given a data set, extrapolate out to large q with Porod and to q=0 with Guinier

_fit_guinier(q, iq)[source]

Fit the Guinier region of the curve

_fit_porod(q, iq)[source]

Fit the Porod region of the curve

_porod(q, K, sigma, bg)[source]

Equation for the Porod region of the data

compute_background(upperq=None)[source]

Compute the background level from the Porod region of the data

compute_extrapolation()[source]

Extrapolate and interpolate scattering data

Returns:

The extrapolated data

compute_transform(extrapolation, trans_type, background=None, completefn=None, updatefn=None)[source]

Transform an extrapolated scattering curve into a correlation function.

Parameters:
  • extrapolation – The extrapolated data

  • background – The background value (if not provided, previously calculated value will be used)

  • extrap_fn – A callable function representing the extraoplated data

  • completefn – The function to call when the transform calculation is complete

  • updatefn – The function to call to update the GUI with the status of the transform calculation

Returns:

The transformed data

extract_parameters(transformed_data)[source]

Extract the interesting measurements from a correlation function

Parameters:

transformed_data – Fourier transformation of the extrapolated data

set_data(data, scale=1)[source]

Prepares the data for analysis

Returns:

new_data = data * scale - background

stop_transform()[source]
transform_isrunning()[source]

sas.sascalc.corfunc.transform_thread module

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

Bases: CalcThread

__doc__ = None
__init__(raw_data, extrapolated_data, bg, updatefn=None, completefn=None)[source]

Prepare the calculator

__module__ = 'sas.sascalc.corfunc.transform_thread'
check_if_cancelled()[source]
compute()[source]

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)[source]

Bases: CalcThread

__doc__ = None
__init__(raw_data, extrapolated_data, bg, updatefn=None, completefn=None)[source]

Prepare the calculator

__module__ = 'sas.sascalc.corfunc.transform_thread'
compute()[source]

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

Module contents