Class Datafield holds experimental or simulated scattering data.
Most important, the function simulation.simulate() returns an object of class Datafield.
A Datafield object contains
To set the title of Datafield df:
df.setTitle("text")
This is particularly useful for disambiguating datafields that are put together in a list.
Functions make_plot and plot_multicurve from module ba_plot
use datafield titles to generate a legend.
For converting axis coordinates, see Convert axes.
For detailed reference, see Export.
To save Datafield values from Python, extract NumPy arrays and use NumPy or another file-format package:
import numpy as np
np.savetxt(file_name, df.intensities())
To extract NumPy arrays from a Datafield df:
df.xCenters() # centers of x bins
df.yCenters() # centers of y bins (2D data)
df.intensities() # intensities
df.errors() # error estimates thereof
For detailed reference, see Plotting.
To plot a Datafield df:
from bornagain import ba_plot as bp
bp.plot_datafield(df)
bp.plt.show()
To determine peaks in a 2d Datafield, use