rsfbpic/rsdata/read_field_hdf.py
def read_scalar(path_to_file, field_name, n_dump_str):
    """
    Read a scalar field by name from an HDF5 file.

    Assume openPMD conventions
    Assume 2D mesh of values (ie quasi-3D rz)
    Args:
        path_to_file: location of a specific HDF5 file
        field_name:   name of field in the HDF5 file
        n_dump_str:   dump number (as a string)
    Returns:
        field:     the requested field data
   """
    file = h5py.File(path_to_file,'r')
    data = file.get('data/')
    step = data.get(n_dump_str)
    all_fields = step.get('fields')
    field_h5 = all_fields.get(field_name)
    field = field_h5[0,:,:]

    return field

    Read a scalar field by name from an HDF5 file.

    Assume openPMD conventions
    Assume 2D mesh of values (ie quasi-3D rz)
    Args:
        path_to_file: location of a specific HDF5 file
        field_name:   name of field in the HDF5 file
        n_dump_str:   dump number (as a string)
    Returns:
        field:     the requested field data
   
Read a scalar field by name from an HDF5 file.
Assume openPMD conventions
Assume 2D mesh of values
Read a scalar field by name from an HDF5 file . Assume openPMD conventions Assume 2D mesh of values
def read_scalar(path_to_file, field_name, n_dump_str):
    file = h5py.File(path_to_file,'r')
    data = file.get('data/')
    step = data.get(n_dump_str)
    all_fields = step.get('fields')
    field_h5 = all_fields.get(field_name)
    field = field_h5[0,:,:]
    return field
def read_scalar ( path_to_file , field_name , n_dump_str ) : file = h5py . File ( path_to_file , 'r' ) data = file . get ( 'data/' ) step = data . get ( n_dump_str ) all_fields = step . get ( 'fields' ) field_h5 = all_fields . get ( field_name ) field = field_h5 [ 0 , : , : ] return field
Read a scalar field by name from an HDF5 file.
Read a scalar field by name from an HDF5 file .
"""
    Read a scalar field by name from an HDF5 file.

    Assume openPMD conventions
    Assume 2D mesh of values (ie quasi-3D rz)
    Args:
        path_to_file: location of a specific HDF5 file
        field_name:   name of field in the HDF5 file
        n_dump_str:   dump number (as a string)
    Returns:
        field:     the requested field data
   """
the requested field data
the requested field data
field
path_to_file
location of a specific HDF5 file
location of a specific HDF5 file
field_name
name of field in the HDF5 file
name of field in the HDF5 file
n_dump_str
dump number (as a string)
dump number ( as a string )