galaxychop.io
module
Module galaxy-chop.
- galaxychop.io.read_hdf5(path_or_stream, softening_s: float = 0.0, softening_dm: float = 0.0, softening_g: float = 0.0)[source]
h5py file reader.
Reads the file containing masses, positions, velocities of stellar, dark matter and gas particles, and constructs a galaxy object. The file may include particle potentials. The softening value can be included.
- Parameters
path_or_stream (str or file-like) – Path to the h5 file containing the properties of the galaxy particles.
softening_s (float, default value = 0) – Softening radius of star particles.
softening_dm (float, default value = 0) – Softening radius of dark matter particles.
softening_g (float, default value = 0) – Softening radius of gas particles.
- Returns
galaxy
- Return type
Galaxy class
object.
- galaxychop.io.to_hdf5(path_or_stream, galaxy, metadata=None, **kwargs)[source]
HDF5 file writer.
It is responsible for storing a galaxy in HDF5 format. The procedure only stores the attributes
m
,x
,y
,z
,vx
,vy
andvz
, since all the other attributes can be derived from these, and thesoftenings
can be arbitrarily changed at the galaxy creation/reading process- Parameters
path_or_stream (str or file-like) – Path or file like objet to the h5 to store the galaxy.
galaxy (galaxychop.data.Galaxy) – The galaxy to store.
metadata (dict or None (default None)) – Extra metadata to store in the h5 file.
kwargs – Extra arguments to the function
astropy.io.misc.hdf5.write_table_hdf5()
- galaxychop.io.read_npy(path_or_stream_star, path_or_stream_dark, path_or_stream_gas, columns, path_or_stream_pot_s=None, path_or_stream_pot_dm=None, path_or_stream_pot_g=None, softening_s: float = 0.0, softening_dm: float = 0.0, softening_g: float = 0.0)[source]
Npy file reader.
Reads npy files containing the masses, positions and velocities of stellar particles, dark matter and gas particles, and constructs a galaxy object. Files containing particle potentials can be included. The softening value can be included.
- Parameters
path_or_stream_star (str or file like) – Path to the npy file containing the properties of the star particles.
path_or_stream_dark (str or file like) – Path to the npy file containing the properties of the dark matter particles.
path_or_stream_gas (str or file like) – Path to the npy file containing the properties of the gas particles.
columns (list) – Specify column names.
path_or_stream_pot_s (str or file like) – Path to the npy file containing the potentials of the star particles.
path_or_stream_pot_dm (str or file like) – Path to the npy file containing the potentials of the dark matter particles.
path_or_stream_pot_g (str or file like) – Path to the npy file containing the potentials of the gas particles.
softening_s (float, default value = 0) – Softening radius of star particles.
softening_dm (float, default value = 0) – Softening radius of dark matter particles.
softening_g (float, default value = 0) – Softening radius of gas particles.
- Returns
galaxy
- Return type
Galaxy class
object.