<commit_before>Setting up images and SEDs
==========================

There are two main kinds of images/SEDs that can be produced for each model:
images/SEDs computed by binning the photons as they escape from the density
grid, and images/SEDs computed by peeling off photon packets at each
interaction into well defined directions. The latter provide more accurate
SEDs and much better signal-to-noise, and are likely to be more commonly used
than the former.

The code currently allows at most one set of binned images, and any number
of sets of peeled images. A set is defined by a wavelength range, image
resolution and extent, and any number of viewing angles.

Common parameters
-----------------

The wavelength range (in microns) for the images/SEDs can be specified using::

    image.set_wavelength_range(n_wav, wav_min, wav_max)

The image size in pixels and the extent of the images can be specified using::

    image.set_image_size(n_x, n_y)
    image.set_image_limits(xmin, xmax, ymin, ymax)

where the image limits should be given in cm. The apertures for the SEDs can
be specified using::

    image.set_aperture_range(n_ap, ap_min, ap_max)

where the apertures should be given in cm. The default is to have one
aperture with infinite size, i.e. measuring all the flux.

Binned images
-------------

To add a set of binned images/SEDs to the model, use::

    image = m.add_binned_images()

The number of bins in the theta and phi direction can be specified using::

    image.set_viewing_bins(10, 10)

Peeled images
-------------

To add a set of peeled images/SEDs to the model, use::

    image = m.add_peeled_images()

The viewing angles can be specified as lists or arrays of theta and phi
values, in degrees. For example, the following produces images from pole-on
to edge-on at constant phi using 20 viewing angles::

    # Set number of viewing angles
    n_view = 20

    # Generate the viewing angles
    theta = np.linspace(0., 90., n_view)
    phi = np.repeat(45., n_view)

    # Set the viewing angles
    image.set_viewing_angles(theta, phi)

A few more advanced parameters are also available, and these are described in :doc:`../advanced/peeloff`.

Uncertainties
-------------

Uncertainties can be computed for SEDs/images (doubling the memory/disk space required)::

    image.set_uncertainties(True)

File output
-----------

Finally, to save space, images can be written out as 32-bit floats instead of 64-bit floats. To write them out as 32-bit floats, use::

    image.set_output_bytes(4)<commit_msg>Fixed typo in docs<commit_after>Setting up images and SEDs
==========================

There are two main kinds of images/SEDs that can be produced for each model:
images/SEDs computed by binning the photons as they escape from the density
grid, and images/SEDs computed by peeling off photon packets at each
interaction into well defined directions. The latter provide more accurate
SEDs and much better signal-to-noise, and are likely to be more commonly used
than the former.

The code currently allows at most one set of binned images, and any number
of sets of peeled images. A set is defined by a wavelength range, image
resolution and extent, and any number of viewing angles.

Common parameters
-----------------

The wavelength range (in microns) for the images/SEDs can be specified using::

    image.set_wavelength_range(n_wav, wav_min, wav_max)

The image size in pixels and the extent of the images can be specified using::

    image.set_image_size(n_x, n_y)
    image.set_image_limits(xmin, xmax, ymin, ymax)

where the image limits should be given in cm. The apertures for the SEDs can
be specified using::

    image.set_aperture_range(n_ap, ap_min, ap_max)

where the apertures should be given in cm. The default is to have one
aperture with infinite size, i.e. measuring all the flux.

Binned images
-------------

To add a set of binned images/SEDs to the model, use::

    image = m.add_binned_images()

The number of bins in the theta and phi direction can be specified using::

    image.set_viewing_bins(10, 10)

Peeled images
-------------

To add a set of peeled images/SEDs to the model, use::

    image = m.add_peeled_images()

The viewing angles should be specified as lists or arrays of theta and phi
values, in degrees. For example, the following produces images from pole-on
to edge-on at constant phi using 20 viewing angles::

    # Set number of viewing angles
    n_view = 20

    # Generate the viewing angles
    theta = np.linspace(0., 90., n_view)
    phi = np.repeat(45., n_view)

    # Set the viewing angles
    image.set_viewing_angles(theta, phi)

A few more advanced parameters are also available, and these are described in :doc:`../advanced/peeloff`.

Uncertainties
-------------

Uncertainties can be computed for SEDs/images (doubling the memory/disk space required)::

    image.set_uncertainties(True)

File output
-----------

Finally, to save space, images can be written out as 32-bit floats instead of 64-bit floats. To write them out as 32-bit floats, use::

    image.set_output_bytes(4)
{'fraction_non_alphanumeric': 0.0896578843885175, 'fraction_numerical': 0.007864726700747149, 'mean_word_length': 3.493816254416961, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4121985', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1435, 'n_words': 692}