Public Member Functions | |
def | __init__ |
def | events |
def | env |
def | steps |
def | runs |
def | break_after |
def | detnames |
def | small_data |
def | master |
Public Attributes | |
rank |
A wrapper for psana.Datasource that maintains the same interface but hides distribution of events to many MPI cores to simplify user analysis code.
Definition at line 40 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::__init__ | ( | self, | ||
ds_string, | ||||
kwargs | ||||
) |
Create a wrapper for psana.Datasource that maintains the same interface but hides distribution of events to many MPI cores to simplify user analysis code. Parameters ---------- ds_string : str A DataSource string, e.g. "exp=xpptut15:run=54:smd" that specifies the experiment and run to access. Example ------- >>> ds = psana.MPIDataSource('exp=xpptut15:run=54:smd') >>> smldata = ds.small_data('my.h5') >>> cspad = psana.Detector('cspad') >>> for evt in ds.events(): >>> mu = np.mean( cspad.calib(evt) >>> smldata.append(cspad_mean=mu) See Also -------- psana.DataSource The serial data access method this class is based on MPIDataSource.small_data Method to create a SmallData object that can aggregate data in a parallel fashion.
Definition at line 43 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::break_after | ( | self, | ||
n_events | ||||
) |
Limit the datasource to `n_events` (max global events). Unfortunately, you CANNOT break safely out of an event iteration loop when running in parallel. Sometimes, one core will break, but his buddies will keep chugging. Then they get stuck waiting for him to catch up, with no idea that he's given up! Instead, use this function to stop iteration safely. Parameters ---------- n_events : int The GLOBAL number of events to include in the datasource (ie. break out of an event loop after this number of events have been processed)
Definition at line 152 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::detnames | ( | self, | ||
which = 'detectors' | ||||
) |
List the detectors contained in this datasource. Parameters ---------- which : str One of: "detectors", "epics", "all". Returns ------- detnames : str A list of detector names and aliases
Definition at line 174 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::env | ( | self | ) |
Definition at line 139 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::events | ( | self | ) |
def src::mpi_datasource::MPIDataSource::master | ( | self | ) |
Definition at line 238 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::runs | ( | self | ) |
Definition at line 148 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::small_data | ( | self, | ||
filename = None , |
||||
save_on_gather = False , |
||||
gather_interval = 100 | ||||
) |
Returns an object that manages small per-event data as well as non-event data (e.g. a sum of an image over a run) Parameters ---------- filename : string, optional A filename to use for saving the small data save_on_gather: bool, optional (default False) If true, save data to HDF5 file everytime results are gathered from all MPI cores gather_interval: unsigned int, optional (default 100) If set to unsigned integer "N", gather results from all MPI cores every "N" events. Events are counted separately on each core. If not set, only gather results from all cores at end-run. Example ------- >>> ds = psana.MPIDataSource('exp=xpptut15:run=54:smd') >>> smldata = ds.small_data('my.h5') >>> cspad = psana.Detector('cspad') >>> for evt in ds.events(): >>> mu = np.mean( cspad.calib(evt) >>> smldata.append(cspad_mean=mu)
Definition at line 191 of file mpi_datasource.py.
def src::mpi_datasource::MPIDataSource::steps | ( | self | ) |
Definition at line 143 of file mpi_datasource.py.
Definition at line 239 of file mpi_datasource.py.