validphys.plotoptions package
Submodules
validphys.plotoptions.core module
- class validphys.plotoptions.core.PlotInfo(kinlabels, dataset_label, *, experiment=None, x=None, extra_labels=None, func_labels=None, figure_by=None, line_by=None, result_transform=None, y_label=None, x_label=None, x_scale=None, y_scale=None, ds_metadata=None, process_description='-', nnpdf31_process, **kwargs)[source]
Bases:
object
- property experiment
- property process_type
- property xlabel
- class validphys.plotoptions.core.PlottingFile(func_labels: dict = <factory>, dataset_label: Optional[str] = None, experiment: Optional[str] = None, nnpdf31_process: Optional[str] = None, data_reference: Optional[str] = None, theory_reference: Optional[str] = None, process_description: Optional[str] = None, y_label: Optional[str] = None, x_label: Optional[str] = None, result_transform: Optional[validphys.plotoptions.plottingoptions.ResultTransformations] = None, x: Optional[str] = None, plot_x: Optional[str] = None, x_scale: Optional[validphys.plotoptions.plottingoptions.Scale] = None, y_scale: Optional[validphys.plotoptions.plottingoptions.Scale] = None, line_by: Optional[list] = None, figure_by: Optional[list] = None, extra_labels: Optional[Mapping[str, List]] = None, normalize: Optional[validphys.plotoptions.plottingoptions.PlottingOptions] = None, already_digested: Optional[bool] = False)[source]
Bases:
PlottingOptions
- normalize: PlottingOptions | None = None
- validphys.plotoptions.core.dict_factory(key_value_pairs)[source]
A dictionary factory to be used in conjunction with dataclasses.asdict to remove nested None values and convert enums to their name.
https://stackoverflow.com/questions/59481989/dict-from-nested-dataclasses
- validphys.plotoptions.core.get_info(data, *, normalize=False, cuts=None, use_plotfiles=True)[source]
Retrieve and process the plotting information for the input data (which could be a DatasetSpec or a CommonDataSpec).
If
use_plotfiles
isTrue
(the default), the PLOTTING files will be used to retrieve the infromation. Otherwise the default configuration (which depends of the process type) will be used.If cuts is None, the cuts of the dataset will be used, but no cuts for commondata.
If cuts is False, no cuts will be used.
If cuts is an instance of Cuts, it will be used.
If normalize is True, the specialization for ratio plots will be used to generate the PlotInfo objects.
- validphys.plotoptions.core.kitable(data, info, *, cuts=None)[source]
Obtain a DataFrame with the kinematics for each data point
- Parameters:
data ((DataSetSpec, CommonDataSpec, Dataset, CommonData)) – A data object to extract the kinematics from.
info (PlotInfo) – The description of the transformations to apply to the kinematics. See
get_info()
cuts (Cuts or None, default=None) – An object to load the cuts from. It is an error to set this if
data
is a dataset. If data is a CommonData, these must be the same as those passed toget_info()
.
- Returns:
table – A DataFrame containing the kinematics for all points after cuts.
- Return type:
pd.DataFrame
validphys.plotoptions.labelers module
Created on Fri Mar 11 20:44:21 2016
@author: Zahari Kassabov
validphys.plotoptions.plottingoptions module
This module is separated from other plotoptions modules to avoid circular dependencies
The class PlottingOptions is used by the commondata reader to check that the plotting options set in plotting are acceptable.
- class validphys.plotoptions.plottingoptions.PlottingOptions(func_labels: dict = <factory>, dataset_label: Optional[str] = None, experiment: Optional[str] = None, nnpdf31_process: Optional[str] = None, data_reference: Optional[str] = None, theory_reference: Optional[str] = None, process_description: Optional[str] = None, y_label: Optional[str] = None, x_label: Optional[str] = None, result_transform: Optional[validphys.plotoptions.plottingoptions.ResultTransformations] = None, x: Optional[str] = None, plot_x: Optional[str] = None, x_scale: Optional[validphys.plotoptions.plottingoptions.Scale] = None, y_scale: Optional[validphys.plotoptions.plottingoptions.Scale] = None, line_by: Optional[list] = None, figure_by: Optional[list] = None, extra_labels: Optional[Mapping[str, List]] = None, normalize: Optional[dict] = None, already_digested: Optional[bool] = False)[source]
Bases:
object
- property all_labels
- result_transform: ResultTransformations | None = None
validphys.plotoptions.resulttransforms module
Created on Tue Apr 19 09:52:43 2016
@author: Zahari Kassabov
Transform the result (central value and error) for plotting.
The functions here receive as arguments the original cental value and error (from e.g. the convolution or commondata) as well as all the labels defined in the plotting file, as keyword arguments. They are expected to return a new central value and a new error. Therefore the signature is:
def xbinexp(cv, error, **labels):
...
return newcv, newerror
validphys.plotoptions.utils module
Created on Tue Mar 15 12:49:39 2016
@author: Zahari Kassabov
- validphys.plotoptions.utils.apply_to_all_columns(df, func)[source]
Apply a function to all columns of a dataframe at the saem time. The parameter names are the names of the column and the values are arrays containing the each column’s values.
- validphys.plotoptions.utils.bins(arr)[source]
Return bins corresponding to unique values of
arr
sorted by value.bins([-3, 5, -3, -3, 0, 1,1,0]) array([0, 3, 0, 0, 1, 2, 2, 1])