yt.analysis_modules.sunrise_export.sunrise_exporter module

Code to export from yt to Sunrise

yt.analysis_modules.sunrise_export.sunrise_exporter.RecurseOctreeDepthFirstHilbert(cell_index, pos, grid, hilbert, output, refined, levels, grids, level, ids, debug=None, tracker=True)[source]

Add three Eulerian fields Sunrise uses

yt.analysis_modules.sunrise_export.sunrise_exporter.create_fits_file(ds, fn, refined, output, particle_data, fle, fre)[source]
yt.analysis_modules.sunrise_export.sunrise_exporter.domains_from_halos(ds, halo_list, frvir=0.15)[source]
yt.analysis_modules.sunrise_export.sunrise_exporter.export_to_sunrise(ds, fn, star_particle_type, fc, fwidth, ncells_wide=None, debug=False, dd=None, **kwargs)[source]

Convert the contents of a dataset to a FITS file format that Sunrise understands.

This function will accept a dataset, and from that dataset construct a depth-first octree containing all of the data in the parameter file. This octree will be written to a FITS file. It will probably be quite big, so use this function with caution! Sunrise is a tool for generating synthetic spectra, available at .

  • ds (Dataset) – The dataset to convert.
  • fn (string) – The filename of the output FITS file.
  • fc (array) – The center of the extraction region
  • fwidth (array) – Ensure this radius around the center is enclosed Array format is (nx,ny,nz) where each element is floating point in unitary position units where 0 is leftmost edge and 1 the rightmost.


Note that the process of generating simulated images from Sunrise will require substantial user input; see the Sunrise wiki at for more information.

yt.analysis_modules.sunrise_export.sunrise_exporter.export_to_sunrise_from_halolist(ds, fni, star_particle_type, halo_list, domains_list=None, **kwargs)[source]

Using the center of mass and the virial radius for a halo, calculate the regions to extract for sunrise. The regions are defined on the root grid, and so individual octs may span a large range encompassing many halos and subhalos. Instead of repeating the oct extraction for each halo, arrange halos such that we only calculate what we need to.

  • ds (Dataset) – The dataset to convert. We use the root grid to specify the domain.
  • fni (string) – The filename of the output FITS file, but depends on the domain. The dle and dre are appended to the name.
  • particle_type (int) – The particle index for stars
  • halo_list (list of halo objects) – The halo list objects must have halo.CoM and halo.Rvir, both of which are assumed to be in unitary length units.
  • (optional) (domains_list) – Ensure that CoM +/- frvir*Rvir is contained within each domain
  • (optional) – Organize halos into a dict of domains. Keys are DLE/DRE tuple values are a list of halos
class yt.analysis_modules.sunrise_export.sunrise_exporter.hilbert_state(dim=None, sgn=None, octant=None)[source]

Bases: object

reorder(i, j, k)[source]
swap(i, j)[source]
class yt.analysis_modules.sunrise_export.sunrise_exporter.position[source]

Bases: object

yt.analysis_modules.sunrise_export.sunrise_exporter.prepare_octree(ds, ile, start_level=0, debug=True, dd=None, center=None)[source]
yt.analysis_modules.sunrise_export.sunrise_exporter.prepare_star_particles(ds, star_type, pos=None, vel=None, age=None, creation_time=None, initial_mass=None, current_mass=None, metallicity=None, radius=None, fle=[0.0, 0.0, 0.0], fre=[1.0, 1.0, 1.0], dd=None)[source]
yt.analysis_modules.sunrise_export.sunrise_exporter.print_oct(data, nd=None, nc=None)[source]
yt.analysis_modules.sunrise_export.sunrise_exporter.round_ncells_wide(dds, fle, fre, nwide=None)[source]
yt.analysis_modules.sunrise_export.sunrise_exporter.round_nearest_edge(ds, fle, fre)[source]