mcstasscript.data.data.McStasDataEvent
mcstasscript.data.data.McStasDataEvent¶
- class mcstasscript.data.data.McStasDataEvent(metadata, events, **kwargs)¶
Class for holding McStas event dataset with data, metadata and plotting preferences. Usually data the first one million events is plotted.
- metadata¶
Holds the metadata for the dataset
- Type
McStasMetaData instance
- name¶
Name of component, extracted from metadata
- Type
str
- Events¶
Event data
- Type
numpy array
- plot_options¶
Holds the plotting preferences for the dataset
- Type
McStasPlotOptions instance
- set_xlabel : string
sets xlabel of data for plotting
- set_ylabel : string
sets ylabel of data for plotting
- set_title : string
sets title of data for plotting
- set_options : keyword arguments
sets plot options, keywords passed to McStasPlotOptions method
- __init__(metadata, events, **kwargs)¶
Initialize a new McStas event dataset, 2 positional arguments
- Parameters
metadata (McStasMetaData instance) – Holds the metadata for the dataset
events (numpy array) – event data
Methods
__init__
(metadata, events, **kwargs)Initialize a new McStas event dataset, 2 positional arguments
find_variable_index
(axis[, flag_info])Returns variable index for given axis name
get_data_column
(axis[, flag_info])Returns data column corresponding to given axis name
get_data_location
()get_label
(axis[, flag_info])Returns data label corresponding to given axis name
make_1d
(axis1[, n_bins, flag_info])Bin event data along to given axis to create binned dataset
make_2d
(axis1, axis2[, n_bins, flag_info])Bin event data along to given axes to create binned dataset
scale_weights
(factor)Scales all event weights with given factor
set_data_location
(data_location)set_plot_options
(**kwargs)set_title
(string)set_xlabel
(string)set_ylabel
(string)- find_variable_index(axis, flag_info=None)¶
Returns variable index for given axis name
Parameters:
- axisstr
Name of desired axis
- flag_info: list
List of flag names used for user variables in event data
- get_data_column(axis, flag_info=None)¶
Returns data column corresponding to given axis name
Parameters:
- axisstr
Name of parameter
- flag_infolist
list of names for user variables in event data set
- get_label(axis, flag_info=None)¶
Returns data label corresponding to given axis name
Parameters:
- axisstr
Name of parameter
- flag_infolist
list of names for user variables in event data set
- make_1d(axis1, n_bins=50, flag_info=None)¶
Bin event data along to given axis to create binned dataset
Parameters:
- axis1str
Name of parameter for binned axis
- n_binsinteger
Number of bins for histogramming
- flag_infolist
list of names for user variables in event data set
- make_2d(axis1, axis2, n_bins=100, flag_info=None)¶
Bin event data along to given axes to create binned dataset
Parameters:
- axis1str
Name of parameter for first axis
- axis2str
Name of parameter for second axis
- n_binsinteger or list
Number of bins for histogramming, can be list with two elements
- flag_infolist
list of names for user variables in event data set
- scale_weights(factor)¶
Scales all event weights with given factor
Parameters:
- factorfloat
Factor with which all weights are scaled