Source Generators API

class pyxsim.light_cone.XrayLightCone(parameter_filename, simulation_type, near_redshift, far_redshift, seed=None, use_minimum_datasets=True, deltaz_min=0.0, minimum_coherent_box_fraction=0.0)[source]
generate_events(photon_prefix, event_prefix, area, exp_time, angular_width, source_model, sky_center, parameters=None, velocity_fields=None, absorb_model=None, nH=None, no_shifting=False, sigma_pos=None, prng=None)[source]

Generate projected events from a light cone simulation.

Parameters
  • photon_prefix (string) – The prefix of the filename(s) containing the photon list. If run in serial, the filename will be “{photon_prefix}.lc{i}.h5”, where i iterates over the elements of the light cone solution. If run in parallel, the filenames will be “{photon_prefix}.lc{i}.{mpi_rank}.h5”.

  • event_prefix (string) – The prefix of the filename(s) which will be written to contain the event list. If run in serial, the filename will be “{event_prefix}.h5”, if run in parallel, the filename will be “{event_prefix}.{mpi_rank}.h5”.

  • area (float, (value, unit) tuple, or YTQuantity) – The collecting area to determine the number of events. If units are not specified, it is assumed to be in cm^2.

  • exp_time (float, (value, unit) tuple, or YTQuantity) – The exposure time to determine the number of events. If units are not specified, it is assumed to be in seconds.

  • angular_width (float, (value, unit) tuple, or YTQuantity) – The angular width of the light cone simulation. If units are not specified, it is assumed to be in degrees.

  • source_model (SourceModel) – A source model used to generate the events.

  • sky_center (array-like) – Center RA, Dec of the events in degrees.

  • parameters (dict, optional) – A dictionary of parameters to be passed for the source model to use, if necessary.

  • velocity_fields (list of fields) – The yt fields to use for the velocity. If not specified, the following will be assumed: [‘velocity_x’, ‘velocity_y’, ‘velocity_z’] for grid datasets [‘particle_velocity_x’, ‘particle_velocity_y’, ‘particle_velocity_z’] for particle datasets

  • absorb_model (string or AbsorptionModel) – A model for foreground galactic absorption, to simulate the absorption of events before being detected. This cannot be applied here if you already did this step previously in the creation of the PhotonList instance. Known options for strings are “wabs” and “tbabs”.

  • nH (float, optional) – The foreground column density in units of 10^22 cm^{-2}. Only used if absorption is applied.

  • no_shifting (boolean, optional) – If set, the photon energies will not be Doppler shifted.

  • sigma_pos (float, optional) – Apply a gaussian smoothing operation to the sky positions of the events. This may be useful when the binned events appear blocky due to their uniform distribution within simulation cells. However, this will move the events away from their originating position on the sky, and so may distort surface brightness profiles and/or spectra. Should probably only be used for visualization purposes. Supply a float here to smooth with a standard deviation with this fraction of the cell size. Default: None

  • prng (integer or RandomState object) – A pseudo-random number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is to use the numpy.random module.

pyxsim.xray_binaries.convert_bands(ind, emin_a, emax_a, emin_b, emax_b)[source]
pyxsim.xray_binaries.get_scale_factor(ind, emin, emax)[source]
pyxsim.xray_binaries.hmxb_cdf(L)[source]
pyxsim.xray_binaries.lmxb_cdf(L)[source]
pyxsim.xray_binaries.make_xrb_particles(data_source, age_field, scale_length, sfr_time_range=(1.0, 'Gyr'), prng=None)[source]

This routine generates an in-memory dataset composed of X-ray binary particles from an input data source containing star particles.

Parameters
  • data_source (YTSelectionContainer) – The yt data source to obtain the data from, such as a sphere, box, disk, etc.

  • age_field (string or (type, name) field tuple) – The stellar age field. Must be in some kind of time units.

  • scale_length (string, (ftype, fname) tuple, (value, unit) tuple, YTQuantity, or Quantity) – The radial length scale over which to scatter the XRB particles from their parent star particle. Can be the name of a smoothing length field for the stars, a (value, unit) tuple, or a YTQuantity.

  • sfr_time_range (string, (ftype, fname) tuple, (value, unit) tuple, YTQuantity, or Quantity, optional) – The recent time range over which to calculate the star formation rate from the current time in the dataset. Default: 1.0 Gyr

  • prng (integer or RandomState object) – A pseudo-random number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is to use the numpy.random module.

pyxsim.xray_binaries.make_xrb_photons(photon_prefix, ds, redshift, area, exp_time, emin, emax, center='c', cosmology=None, prng=None)[source]

Take a dataset produced by make_xrb_particles() and produce a PhotonList.

Parameters
  • photon_prefix (string) – The prefix of the filename(s) containing the photon list. If run in serial, the filename will be “{photon_prefix}.h5”, if run in parallel, the filenames will be “{photon_prefix}.{mpi_rank}.h5”.

  • ds (Dataset) – The dataset of XRB particles to use to make the photons.

  • redshift (float) – The cosmological redshift for the photons.

  • area (float, (value, unit) tuple, YTQuantity, or Quantity) – The collecting area to determine the number of photons. If units are not specified, it is assumed to be in cm^2.

  • exp_time (float, (value, unit) tuple, YTQuantity, or Quantity) – The exposure time to determine the number of photons. If units are not specified, it is assumed to be in seconds.

  • emin (float, (value, unit) tuple, YTQuantity, or Quantity) – The minimum energy of the photons to be generated, in the rest frame of the source. If units are not given, they are assumed to be in keV.

  • emax (float, (value, unit) tuple, YTQuantity, or Quantity) – The maximum energy of the photons to be generated, in the rest frame of the source. If units are not given, they are assumed to be in keV.

  • center (string or array_like, optional) – The origin of the photon spatial coordinates. Accepts “c”, “max”, or a coordinate. If not specified, pyxsim attempts to use the “center” field parameter of the data_source.

  • cosmology (Cosmology, optional) – Cosmological information. If not supplied, we try to get the cosmology from the dataset. Otherwise, LCDM with the default yt parameters is assumed.

  • prng (integer or RandomState object) – A pseudo-random number generator. Typically will only be specified if you have a reason to generate the same set of random numbers, such as for a test. Default is to use the numpy.random module.