Experiment¶
The experimental data is stored in an Experiment class. Underneath we use Scipp and Plopp to handle and plot the data. We here show how to load an example data set, rebin it and plot it in various ways.
In [1]:
Copied!
import pooch
from easydynamics.experiment import Experiment
%matplotlib widget
import pooch
from easydynamics.experiment import Experiment
%matplotlib widget
In [2]:
Copied!
# Load and plot example vanadium data
# Load the vanadium data
vanadium_experiment = Experiment('Vanadium')
file_path = pooch.retrieve(
url='https://github.com/easyscience/dynamics-lib/raw/refs/heads/docs/docs/docs/tutorials/data/vanadium_data_example.h5',
known_hash='16cc1b327c303feeb88fb9dda5390dc4880b62396b1793f98c6fef0b27c7b873',
)
vanadium_experiment.load_hdf5(filename=file_path)
vanadium_experiment.plot_data()
# Load and plot example vanadium data
# Load the vanadium data
vanadium_experiment = Experiment('Vanadium')
file_path = pooch.retrieve(
url='https://github.com/easyscience/dynamics-lib/raw/refs/heads/docs/docs/docs/tutorials/data/vanadium_data_example.h5',
known_hash='16cc1b327c303feeb88fb9dda5390dc4880b62396b1793f98c6fef0b27c7b873',
)
vanadium_experiment.load_hdf5(filename=file_path)
vanadium_experiment.plot_data()
Out[2]:
In [3]:
Copied!
# Rebin the data and plot again
vanadium_experiment.rebin({'Q': 5, 'energy': 50})
vanadium_experiment.plot_data()
# Rebin the data and plot again
vanadium_experiment.rebin({'Q': 5, 'energy': 50})
vanadium_experiment.plot_data()
Out[3]:
In [4]:
Copied!
# Plot using the plopp slicer with extra arguments
vanadium_experiment.plot_data(slicer=True, keep='energy', vmin=0, vmax=2.0)
# Plot using the plopp slicer with extra arguments
vanadium_experiment.plot_data(slicer=True, keep='energy', vmin=0, vmax=2.0)
Out[4]: