def load_configuration_from_hdf5(register, configuration_file, node='<STR_LIT>'):
def load_conf():<EOL><INDENT>logging.info("<STR_LIT>" % h5_file.filename)<EOL>register.configuration_file = h5_file.filename<EOL>if node:<EOL><INDENT>configuration_group = h5_file.root.configuration.node<EOL><DEDENT>else:<EOL><INDENT>configuration_group = h5_file.root.configuration<EOL><DEDENT>for row in configuration_group.miscellaneous:<EOL><INDENT>name = row['<STR_LIT:name>']<EOL>try:<EOL><INDENT>value = literal_eval(row['<STR_LIT:value>'])<EOL><DEDENT>except ValueError:<EOL><INDENT>value = row['<STR_LIT:value>']<EOL><DEDENT>if name == '<STR_LIT>':<EOL><INDENT>if register.flavor:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>register.init_fe_type(value)<EOL><DEDENT><DEDENT>elif name == '<STR_LIT>':<EOL><INDENT>if register.chip_address:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>register.set_chip_address(chip_address=value & <NUM_LIT>, broadcast=True if value & <NUM_LIT> else False)<EOL><DEDENT><DEDENT>elif name == '<STR_LIT>':<EOL><INDENT>if register.chip_address:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>register.set_chip_address(chip_address=value, broadcast=False)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>register.miscellaneous[name] = value<EOL><DEDENT><DEDENT>if register.flavor:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if register.chip_id_initialized:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>for row in configuration_group.calibration_parameters:<EOL><INDENT>name = row['<STR_LIT:name>']<EOL>value = row['<STR_LIT:value>']<EOL>register.calibration_parameters[name] = literal_eval(value)<EOL><DEDENT>for row in configuration_group.global_register:<EOL><INDENT>name = row['<STR_LIT:name>']<EOL>value = row['<STR_LIT:value>']<EOL>register.set_global_register_value(name, literal_eval(value))<EOL><DEDENT>for pixel_reg in h5_file.iter_nodes(configuration_group, '<STR_LIT>'):  <EOL><INDENT>if pixel_reg.name in register.pixel_registers:<EOL><INDENT>register.set_pixel_register_value(pixel_reg.name, np.asarray(pixel_reg).T)  <EOL><DEDENT><DEDENT><DEDENT>if isinstance(configuration_file, tb.file.File):<EOL><INDENT>h5_file = configuration_file<EOL>load_conf()<EOL><DEDENT>else:<EOL><INDENT>with tb.open_file(configuration_file, mode="<STR_LIT:r>", title='<STR_LIT>') as h5_file:<EOL><INDENT>load_conf()<EOL><DEDENT><DEDENT>
Loading configuration from HDF5 file to register object

    Parameters
    ----------
    register : pybar.fei4.register object
    configuration_file : string, file
        Filename of the HDF5 configuration file or file object.
    node : string
        Additional identifier (subgroup). Useful when more than one configuration is stored inside a HDF5 file.