damaris.data.Accumulation

class damaris.data.Accumulation(x: ndarray | list | None = None, y: list[ndarray] | None = None, y_2: list[ndarray] | ndarray | None = None, n: int | None = None, index: list[tuple[int, int]] | None = None, sampl_freq: float | None = None, error: bool = False)[source]

Represents an accumulation of sampled data with various attributes and methods for data manipulation, analysis, and exporting.

This class handles statistical computations and provides mechanisms for thread-safe operations and data interaction.

Attributes: xlabel (str): Label for the x-axis. ylabel (str): Label for the y-axis. lock (threading.RLock): A reentrant lock to ensure thread-safe operations. common_descriptions (dict|None): A dictionary containing common descriptions of the data. time_period (list): A list to store the periods of time relevant to the accumulation. job_id (int|None): An identifier for the job associated with this accumulation. use_error (bool): Indicates whether statistical error calculations are enabled. sampling_rate (float): Sampling frequency of the data. n (int): Number of accumulations. cont_data (bool): Indicates whether the object contains valid data. index (list): List of index bounds for data segments. x (list): The x-axis data points. y (list): The y-axis data points.

__init__(x: ndarray | list | None = None, y: list[ndarray] | None = None, y_2: list[ndarray] | ndarray | None = None, n: int | None = None, index: list[tuple[int, int]] | None = None, sampl_freq: float | None = None, error: bool = False) → None[source]

Methods

__init__([x, y, y_2, n, index, sampl_freq, ...])

autophase()

Automatically phases the data to maximize real part.

bartlett_window()

Symmetric centered window (bartlett)

baseline([last_part])

Correct the baseline of your data by subtracting the mean of the last_part fraction of your data.

blackman_window()

Symmetric centered window (blackmann)

clip([start, stop])

Method for clipping data, returns only the data between start and stop start and stop can be either time or frequency.

contains_data()

Return whether the measurement contains samples.

dexp_window([line_broadening, ...])

exp_window([line_broadening])

Exponential window function

fft([samples])

Calculate the Fourier transform of the data inplace.

gauss_window([line_broadening])

Gaussian window function

get_Result_by_index(index)

get_accu_by_index(index)

get_bars_above()

Gets bars-above property of errorplot

get_error_color()

Returns the error-bar color

get_index_bounds(index)

Returns a tuple with (start, end) of the wanted result

get_job_id()

Returns the job identifier associated with this accumulation.

get_legend()

Returns the legend of the plot (Dictionary)

get_number_of_channels()

Return the number of data channels.

get_phase([pos])

Return the phase in degrees from the first two channels.

get_result_by_index(index)

get_sampling_rate()

Returns the sampling frequency

get_style()

Returns a reference to plot-styles (dictionary)

get_text(index)

Returns labels to be plotted (List)

get_title()

Returns the title of the plot

get_xdata()

Returns a reference to the x-Plotdata (array)

get_xerr()

Returns a reference to x-Error (array)

get_xlabel()

Returns the label for the x-axis

get_xmax()

Returns maximum of x

get_xmin()

Returns minimun of x

get_xminpos()

Returns smallest positive value of x

get_ydata([channel])

return mean data

get_yerr(channel)

return error (std.dev/sqrt(n)) of mean

get_ylabel()

Gets the label for the y-axis

get_ymax()

Returns the global maximum value of all channels.

get_ymax_channels()

Return the maximum value of each channel.

get_ymean([start, stop])

Return the mean of every channel over a time interval.

get_ymin()

Return the global minimum across all channels.

get_ymin_channels()

Return the minimum value of each channel.

get_yminpos()

Returns smallest positive value of y

get_yrms()

Return the root-mean-square value of each channel.

get_ysquare(channel)

get_ystd()

Return the population standard deviation of each channel.

hamming_window()

Symmetric centered window (hamming)

hanning_window()

Symmetric centered window (hanning)

kaiser_window([beta, use_scipy])

Symmetric centered window (kaiser)

magnitude()

Return absolute signal, i.e.:

phase(degrees)

rotate signal by degrees for phase cycling, etc.

ppm(f_ref)

Return result scaled to PPM compared to f_ref

ready_for_drawing_error()

Returns true if more than one result have been accumulated

set_bars_above(bars_above)

Sets bars-above property of errorplot

set_error_color(color)

Sets the error-bar color

set_legend(channel, value)

Sets the legend of the plot

set_style(channel, value)

Sets a channel to a certain plot-style

set_text(index, text)

Sets labels to be plotted

set_title(title)

Sets the title of the plot

set_xdata(pos, value)

Sets a point in x

set_xerr(pos, value)

Sets a point in x-Error

set_xlabel(label)

Sets the label for the x-axis

set_xmax(xmax)

Sets maximum of x

set_xmin(xmin)

Sets minimum of x

set_ydata(channel, pos, value)

Sets a point in y

set_yerr(channel, pos, value)

Sets a point in y-Error

set_ylabel(label)

Sets the label for the y-axis

set_ymax(ymax)

Sets maximum of y

set_ymin(ymin)

Sets minimum of y

traf_window([line_broadening])

uses_statistics()

write_to_csv([destination, delimiter])

Write the accumulation data to a whitespace-delimited text file with comment headers.

write_to_hdf(hdffile, where, name, title[, ...])

Write the accumulation data to an HDF5 file using PyTables.

write_to_simpson([destination, delimiter, ...])

Write the accumulation data to a text file in Simpson format for NMRnotebook.

write_to_tecmag([destination, nrecords, ...])

Write the accumulation data to a binary TecMag file.