Try to figure out what type of data is in filename.
path.
Try to find the redshift hidden in the filename. If there are many sequences of numbers in the filename this method will guess that the longest sequence is the redshift.
If no redshift could be found, return -1
Find the (fractional) indices of values in an array. If values contains values outside of the range of ar, these will be clamped to the bounds of ar.
Compare two floats, return true of difference is < epsilon
Extract the actual data from an object (which may be a file object or a filename to be read), and determine what type of data it is.
indata (XfracFile, DensityFile, string or numpy array): the data
cbin_bits (integer): the number of bits to use if indata is a cbin file
cbin_order (string): the order of the data in indata if it’s a cbin file
density file, the raw (simulation units) density will be returned instead of the density in cgs units
containing the actual data and type is a string with the type of data. Possible values for type are ‘xfrac’, ‘density’, ‘cbin’ and ‘unknown’
Make a list of the redshifts of all the density files in a directory.
dens_dir (string): the directory to look in
z_low = None (float): the minimum redshift to include (if given)
z_high = None (float): the maximum redshift to include (if given)
lower side of z_low and the higher side of z_high
Evaluate an expression using numexpr if available. For internal use.
Get a higher-res version of an array.
Read only the first three integers that specify the mesh size of a file.
a density file or a cbin file.
Make a list of the redshifts of all the xfrac files in a directory.
xfrac_dir (string): the directory to look in
z_low = None (float): the minimum redshift to include (if given)
z_high = None (float): the maximum redshift to include (if given)
lower side of z_low and the higher side of z_high
If given a list with only one element, return the element If given a standard python list or tuple, make it into a numpy array.
Print a message if verbose is true
Read a binary file with three inital integers (a cbin file).
filename (string): the filename to read from
bits = 32 (integer): the number of bits in the file
for C style ordering, or ‘F’ for fortran style.
dimensions (int): the number of dimensions of the data (default:3)
Read a fits file and return the data as a numpy array
Read a raw binary file with no mesh info. The mesh is assumed to be cubic.
filename (string): the filename to read from
bits = 64 (integer): the number of bits in the file
for C style ordering, or ‘F’ for fortran style.
Save a binary file with three inital integers (a cbin file).
filename (string): the filename to save to
data (numpy array): the data to save
bits = 32 (integer): the number of bits in the file
for C style ordering, or ‘F’ for fortran style.
Save data as a fits file. The data can be a file object, a file to read or a pure data array.
Save a raw binary file with no mesh info.
filename (string): the filename to read from
data (numpy array): the data to save
bits = 64 (integer): the number of bits in the file
for C style ordering, or ‘F’ for fortran style.
Turn on or off verbose mode.