[docs]defload_vector_from_hdf5(handle:h5py.Dataset,expected_type:type,report_1darray:bool)->Union[StringList,IntegerList,FloatList,BooleanList,numpy.ndarray]:""" Load a vector from a 1-dimensional HDF5 dataset, with coercion to the expected type. Any missing value placeholders are used to set Nones or to create masks. Args: handle: Handle to a HDF5 dataset. expected_type: Expected type of the output vector. This should be one of ``float``, ``int``, ``str`` or ``bool``. report_1darray: Whether to report the output as a 1-dimensional NumPy array. Returns: The contents of the dataset as a vector-like object. By default, this is a typed :py:class:`~biocutils.biocutils.NamedList` subclass with missing values represented by None. If ``keep_as_1darray = True``, a 1-dimensional NumPy array is returned instead, possibly with masking. """ifexpected_type==str:values=strings.load_string_vector_from_hdf5(handle)placeholder=Noneif"missing-value-placeholder"inhandle.attrs:placeholder=strings.load_scalar_string_attribute_from_hdf5(handle,"missing-value-placeholder")ifreport_1darray:values=numpy.array(values)ifplaceholderisnotNone:mask=values==placeholdervalues=numpy.ma.MaskedArray(values,mask=mask)else:ifplaceholderisnotNone:forj,yinenumerate(values):ify==placeholder:values[j]=Nonevalues=StringList(values)returnvaluesvalues=handle[:]if"missing-value-placeholder"inhandle.attrs:placeholder=handle.attrs["missing-value-placeholder"]ifnumpy.isnan(placeholder):mask=numpy.isnan(values)else:mask=(values==placeholder)ifreport_1darray:returnnumpy.ma.MaskedArray(_coerce_numpy_type(values,expected_type),mask=mask)else:output=[]fori,yinenumerate(values):ifmask[i]:output.append(None)else:output.append(y)return_choose_NamedList_subclass(output,expected_type)ifreport_1darray:return_coerce_numpy_type(values,expected_type)else:return_choose_NamedList_subclass(values,expected_type)