temet.vis

Visualization routines, which are broadly split into two types: ‘box’ and ‘halo’.

In each case, an assortment of drivers and examples are available in vis.boxDrivers and vis.haloDrivers, respectively. Light option parsing and pre-processing is handled in vis.box and vis.halo, respectively. In both cases, most of the work is actually accomplished in vis.common.

temet.vis.arepovtk

Processing of ArepoVTK tiled output, to create image pyramids, and support Explorer functionality.

process()

Process ArepoVTK output files into image pyramids for Explorer visualization.

processMark()

Process the visualization output of Mark (DM density) into image pyramids for Explorer visualization.

processShy()

Process the stellar light visualization output of Shy into image pyramids for Explorer visualization.

expandedJobNums(jobNum, totNumJobs=256, expansionFac=16)

Calculate the expanded job numbers corresponding to a parent ArepoVTK job.

combineExpandedJob(jobNum)

Combine the expanded ArepoVTK job outputs into a single file for a given parent job number.

makeColorBars()

Create a PDF with all colormaps used in ArepoVTK for reference.

writeColorTable(ctName='inferno')

Output a .tbl discrete color table for use in ArepoVTK, from one that loadColorTable() knows.

writeColormapPNGs()

Output .png images of colormaps for loading as textures in three.js / Explorer3D volume rendering.

temet.vis.box

Visualizations for whole (cosmological) boxes.

boxImgSpecs(sP, zoomFac, sliceFac, relCenPos, absCenPos, axes, nPixels, boxOffset, remapRatio, **kwargs)

Factor out some box/image related calculations common to all whole box plots.

Image zoomFac fraction of entire fullbox/subbox, zooming around relCenPos ([0.5,0.5] being box center point).

renderBox(panels_in, plotConfig=None, localVars=None, skipExisting=False, retInfo=False, returnData=False)

Render views of a full cosmological box (or a zoomed subset), with a variable number of image panels.

These can compare any combination of parameters (res, run, redshift, vis field, vis type, vis direction, …).

renderBoxFrames(panels_in, plotConfig=None, localVars=None, curTask=0, numTasks=1, skipExisting=True)

Render views of a cosmological box, with a variable number of panels, for many snapshots to make a movie.

temet.vis.boxDrivers

Render specific fullbox visualizations.

realizations(conf=1)

Render a whole box image at one redshift, of one field, comparing multiple runs.

TNG_mainImages(res, conf=0, variant=None, thinSlice=False)

Create the FoF[0/1]-centered slices to be used for main presentation of the box.

singleFullBox(conf=0)

Create a full box view.

TNG_remapImages(res, redshift=0.0, conf=0, variant=None, phase=None, colorbars=False)

Create the full-box (full volume) remapped images.

fullBox360(res, conf=34, variant=None, snap=None)

Create full box 180 or 360 degree images in various projections.

smuggleMWAndromedaMergerDome(snap=100)

Create 180 degree dome renders for the smuggle Andromeda-Milky Way merger sim.

dragonflyHalpha(res=1820)

Create the FoF[0/1]-centered slices to be used for main presentation of the box.

TNG_colorFlagshipBoxImage(part=0)

Create the parts of the fullbox demonstration image for the galaxy colors L75/L205 flagship paper.

TNG_oxygenPaperImages(part=0)

Create the parts of the fullbox demonstration image for the TNG oxygen paper.

TNG_explorerImageSegments(conf=0, taskNum=0, retInfo=False)

Construct image segments which are then split into the pyramids for the TNG explorer 2d.

oneBox_LIC(res, conf=0, variant=None, thinSlice=False)

Testing whole-box LIC.

oneBox_multiQuantCollage(variant=0)

Make a collage for a single run, of every quantity we can.

(now 15=5x3 panels, 1.67 aspect ratio vs 1.78 for 1920x1080 or 1.6 for 1920x1200).

multiBoxComparison()

Compare two boxes, side-by-side, one quantity.

oneBox_redshiftEvoPanels(redshifts=(6.0, 2.0, 0.8))

Create a linear series of redshift evolution panels for one simulation + one quantity.

zoom_gasColDens_3res_or_3quant()

Diagnostic plot of gas column dens in the entire zoom box at z=2 (e.g. 3 res or 3 quant comp).

box_slices(curSlice=7, conf=0)

Create a series of slices moving through a box (no halo centering).

fire2_publicdata(fire_run='core_FIRE-2_runs/m12i_res7100/')

Test full-box visualization of one of the publicly released FIRE-2 Milky Way runs.

temet.vis.boxMovieDrivers

Render specific fullbox (movie frame) visualizations.

subbox_4x2_movie(curTask=0, numTasks=1)

Render a movie comparing several quantities of a single subbox (4x2 panels, 4K).

subbox_2x1_movie(curTask=0, numTasks=1)

Render a movie comparing two quantities of a single subbox (2x1 panels, 4K).

subbox_movie_tng300fof0(curTask=0, numTasks=1)

Render a movie of the TNG300 most massive cluster (1 field, 4K).

subbox_movie_tng300fof0_persrot(curTask=0, numTasks=1)

Render a movie of the TNG300 most massive cluster (1 field, 4K). Perspective camera with rotation.

subbox_movie_tng300fof0_tracking(conf=0, clean=False)

Use the subbox tracking catalog to create a movie highlighting the evolution of the TNG300 FoF0.

subbox_movie_tng300fof0_4x2(curTask=0, numTasks=1)

Render a movie comparing several quantities of a single subbox (4x2 panels, 4K).

subbox_movie_tng50(curTask=0, numTasks=1, conf='one', render8k=False)

Render a 4K movie of a single field from one subbox.

subbox_movie_tng_galaxyevo_frame(sbSnapNum=2687, gal='two', conf='one', frameNum=None, rotSeqFrameNum=None, rotSeqFrameNum2=None, cat=None)

Use the subbox tracking catalog to create a movie highlighting the evolution of a single galaxy.

If frameNum is not None, then use this for save filename instead of sbSnapNum. If rotSeqFrameNum is not None, then proceed to render rotation squence (at fixed time iff sbSnapNum is kept fixed).

subbox_movie_tng_galaxyevo(gal='one', conf='one')

Control creation of individual frames using the above function.

Illustris_vs_TNG_subbox0_2x1_onequant_movie(curTask=0, numTasks=1, conf=1)

Render a movie comparing Illustris-1 and L75n1820TNG subbox0, one quantity side by side.

subbox_highz_gasdens(curTask=0, numTasks=1)

Render a movie of the high-z evolution (down to ~1 Gyr, z=5) of a subbox.

Illustris_vs_TNG_subbox0_4x2_movie(curTask=0, numTasks=1)

Render a movie comparing Illustris-1 (top) and L75n1820TNG subbox0 (bottom), 4 quantities per row.

Illustris_1_4subboxes_gasdens_movie(curTask=0, numTasks=1)

Render a movie of a single quantity from multiple subboxes.

planetarium_TychoBrahe_frames(curTask=0, numTasks=1, conf=0)

Render a movie comparing Illustris-1 and L75n1820TNG subbox0, one quantity side by side.

temet.vis.common

Visualizations: common routines.

addBoxMarkers(p, conf, ax, pExtent)

Factor out common annotation/markers to overlay.

addVectorFieldOverlay(p, conf, ax)

Add quiver or streamline overlay on top to visualization vector field data.

addContourOverlay(p, conf, ax)

Add set of contours on top to visualize a second field.

addCustomColorbars(fig, conf, config, heightFac, barAreaBottom, barAreaTop, color2, colWidth, leftNorm, hOffset=None)

Add colorbar(s) with custom positioning and labeling, either below or above panels.

renderMultiPanel(panels, conf)

Generalized plotting function which produces a multi-panel plot, all of which can vary in their configuration.

Parameters:
  • conf (dict) – Global plot configuration options. See renderSingleHalo() and renderBox() for available options and their default values.

  • panels (list) – Each panel must be a dictionary containing the following keys. See renderSingleHalo() and renderBox() for available options and their default values.

Returns:

None. Figure is produced in current directory.

temet.vis.halo

Visualizations for individual halos/subhalos from ..cosmological runs.

haloImgSpecs(sP, size, sizeType, nPixels, axes, relCoords, rotation, inclination, mpb, cenShift, depthFac, depth, depthType, **kwargs)

Factor out some box/image related calculations common to all halo plots.

renderSingleHalo(panels_in, plotConfig=None, localVars=None, skipExisting=False, returnData=False)

Render view(s) of a single halo in one plot, with a variable number of panels.

Compare any combination of parameters (res, run, redshift, vis field, vis type, vis direction, …).

renderSingleHaloFrames(panels_in, plotConfig=None, localVars=None, skipExisting=True)

Render view(s) of a single halo, repeating across all snapshots using the smoothed MPB properties.

selectHalosFromMassBin(sP, massBins, numPerBin, haloNum=None, massBinInd=None, selType='linear')

Select subhalos IDs from a set of halo mass bins, using different sampling methods.

Parameters:
  • sP (simParams) – simulation instance.

  • massBins (list[tuple,2]) – list of [min,max] 2-tuples of halo mass bins [log Msun].

  • numPerBin (int) – requested number of halos per bin.

  • haloNum (int or None) – an index haloNum which should iterate from 0 to the total number of halos requested across all bins, in which case each return is a single subhalo ID, as appropriate for a multi-quantity single system comparison figure. Specify either haloNum or massBinInd, not both.

  • massBinInd (int or None) – an index ranging from 0 to the number of bins, in which case all subhalo IDs in that bin are returned (limited to numPerBin), as appropriate for a multi-system single-quantity figure.

  • selType (str) – selection type within mass bin, one of “linear”, “even”, “random”.

selectHalosFromMassBins(sP, massBins, numPerBin, selType='linear')

Select one or more halo IDs from a set of halo mass bins, using different sampling methods.

Parameters:
  • sP (simParams) – simulation instance.

  • massBins (list[tuple,2]) – list of [min,max] 2-tuples of halo mass bins [log Msun].

  • numPerBin (int) – requested number of halos per bin.

  • selType (str) – selection type within mass bin, one of “linear”, “even”, “random”.

temet.vis.haloDrivers

Render specific halo visualizations.

oneHaloSingleField(conf=0, haloID=None, subhaloInd=None, redshift=0.0)

In a single panel(s) centered on a halo, show one field from the box.

oneHaloGaussProposal()

Render single halo with B field streamlines for Gauss proposal (MHD figure).

oneGalaxyThreeRotations(conf=0)

Plot stellar and gas images of a single galaxy, with three different rotations.

resSeriesGaussProposal(fofInputID=12, resInput=256)

Render a 3x2 panel resolution series for Gauss proposal (MW/structural fig).

multiHalosPagedOneQuantity(curPageNum, numPages=7)

Split over several pages, plot many panels, one per halo, showing a single quantity.

loopInputSerial()

Call another driver function several times, looping over a possible input.

boxHalo_HI()

Single halo HI plots (col dens, line of sight velocity) with smoothing.

boxHalo_MultiQuant()

Diagnostic plot, a few quantities of a halo from a periodic box.

zoomHalo_z2_MultiQuant()

For a single zooms/zooms2 halo at z=2, plot several panels comparing different quantities.

tng50_firstNhalos(conf=0)

Plot gas/stellar densities of the N most massive halos (at some redshift). All separate (fullpage) plots.

tngMethods2_stamps(conf=0, curPage=None, numPages=None, rotation=None, variant=None, matchedToVariant=None)

Plot stellar stamps of N random massive L25n512_0000 galaxies.

If curPage,numPages both specified, do a paged exploration instead. If matchedToVariant is not None, then run the halo selection on this variant instead (e.g. always 0000) and then use the SubhaloMatching catalog to pick the matched halos in this run. https://arxiv.org/abs/1703.02970 (Figure 3).

loop_stamps()

Helper.

massBinsSample_3x2_EdgeOnFaceOn(res, conf, haloOrMassBinNum=None, panelNum=None)

For a series of mass bins, take a uniform number of halos from each and make different plots.

Either (i) a 3x2 plot with the top row face-on and the bottom row edge-on, one plot per galaxy, or (ii) montage pages showing many galaxies at once, one per mass bin and quantify.

loopMassBins()

Call another driver function several times, looping over a possible input.

tngFlagship_galaxyRedBlue(blueSample=False, redSample=False, greenSample=False, evo=False, curPage=None, conf=0)

Plot stellar stamps red/blue galaxies around 10^10.5 Msun.

If evo==True, then tracked back in time from z=0 to z=2.0 in M steps using the merger tree. If evo==False, then show full NxM panel sample at z=0. In either case, choose blueSample, redSample, or greenSample. If curPage specified, do a paged exploration instead.

vogelsberger_redBlue42(run='illustris', sample='blue')

Recreate the ‘Vogelsberger+ (2014) sample of 42 red/blue galaxies’, either for Illustris-1 or TNG100-1.

Or, if sample==’guinevere’, same for the Milky Way mass sample of Kauffmann+ (2016).

temet.vis.haloMovieDrivers

Render specific halo movie/time-series visualizations.

tngCluster_center_timeSeriesPanels(conf=0)

Plot a time series of panels from subsequent snapshots in the center of fof0.

loopTimeSeries()

Helper: Loop the above over configs.

zoomEvoMovies(conf)

Configurations to render movies of the sims.zooms2 runs (at ~400 total snapshots).

singleEvoFrames_3x2(frame=0, subhaloID=402572, justStars=False)

Plot frames for a time-evolution movie (using merger tree) of a single halo/galaxy.

3x2 panels: stars, DM, gas, galaxy-scale and halo-scale. Or 2x1 panels: just one component.

static_halo_rotation_fullbox(objInd=10, conf='one')

Create movie frames for a rotation about a single halo in a fullbox (static in time).

temet.vis.lic

Line integral convolution algorithm.

line_integral_convolution(input, velocity, kernel, origin=0, order=3, weighted='average', step_size='unit_length', maximum_velocity=None)

Line integral convolution of an input image with an arbitrary kernel. Lines are defined by a velocity field.

Parameters:
  • input (array_like) – Random image to be convolved (can be created for instance with``1. * (np.random.random(shape) > 0.5)``).

  • velocity (array_like) – One velocity vector for each pixel. Must have shape input.shape + (input.ndim,). First dimensions are identical to the shape of the random input image, the last dimension defines the coordinate of the velocity.

  • kernel (array_like) – 1-D array with at least on element. Defines the convolution kernel (e.g. a Gaussian kernel constructed with scipy.stats.norm.norm.pdf(np.linspace(-3,3,50))). The flow direction can be visualized by using an asymmetric kernel in combination with an origin parameter equal to None or equivalently -(len(kernel) // 2).

  • origin (int, optional) – Placement of the filter, by default 0 (which is correct for symmetric kernels). The flow direction can be visualized by using an asymmetric kernel in combination with an origin parameter equal to None or equivalently -(len(kernel) // 2).

  • order (int, optional) – The order of the spline interpolation used for interpolating the input image and the velocity field, by default 3. See the documentation of scipy.ndimage.interpolation.map_coordinates for more details.

  • weighted (str, optional) – Can be either 'average' or 'integral', by default 'average'. If set to 'average', the weighted average is computed. If set to 'integral', the weighted integral is computed. See the examples to see which parameter is appropriate each use case.

  • step_size (str, optional) – Can be either 'unit_length' or 'unit_time', by default 'unit_length'. If set to 'unit_length', the integration step is the velocity scaled to unit length. If set to 'unit_time', the step equals the velocity.

  • maximum_velocity (float, optional) – Is None by default. If it is not None, the velocity field is mutiplied with a scalar variable s.t. the maximum velocity after multiplication equals maximum_velocity.

Returns:

Returned array of same shape as input.

Return type:

ndarray

See also

lic_test_plot()

Visualize a 2-D vortex with different configurations of the line_integral_convolution algorithm.

Use the 2-D vortex to add motion blur to a sample image.

temet.vis.pyramid

ArepoVTK/Web: building image pyramids.

rebin(a, shape)

See REBIN() IDL function.

getDataArrayHDF5(filename, fieldName)

Load a single dataset from a HDF5 file with read_direct().

loadCPTColorTable(ct)

Load a color table in CPT format.

genColorTable(fieldName)

Generate a color table for a given field name.

saveImageToPNG(filename, array_rgb)

Write a raw RGB array into a PNG image file.

getColorTableParams(fieldName)

Set colortable and its parameters, for a given field name.

make_pyramid_all(config)

Create all sub-images for an image pyramid.

make_pyramid_upper(config)

Make upper sections of an image pyramid (reducing size from tiled images).

make_pyramid_lower(config)

Make lower sections of an image pyramid.

shuffleFixAll()

Fix images where the four quadrants are shuffled.

combine4to1(fnames_in, fname_out)

Combine four PNG images into one larger PNG image.

combine4All()

Combine sets of four PNG images into larger PNG images.

pyramidTNG(fieldName='gassynch')

Combine files for TNG Explorer2D and write out image pyramid files.

temet.vis.quantities

Visualizations: physical quantities.

validPartFields(ions=True, emlines=True, bands=True)

Helper, return a list of all field names we can handle.

gridOutputProcess(sP, grid, partType, partField, boxSizeImg, nPixels, projType, method=None)

Perform any final unit conversions on grid output and set field-specific plotting configuration.

temet.vis.render

Visualizations: render actual image.

getHsmlForPartType(sP, partType, nNGB=64, indRange=None, useSnapHsml=False, alsoSFRgasForStars=False, pSplit=None)

Calculate an approximate HSML (smoothing length, i.e. spatial size) for particles of a given type.

By default for the full snapshot, optionally restricted to an input indRange.

defaultHsmlFac(partType)

Helper, set default hsmlFac for a given partType if not input.

clipStellarHSMLs(hsml, sP, pxScale, nPixels, indRange, method=2)

Clip input stellar HSMLs/sizes to minimum/maximum values. Work in progress.

stellar3BandCompositeImage(sP, partField, method, nPixels, axes, projType, projParams, boxCenter, boxSizeImg, hsmlFac, rotMatrix, rotCenter, remapRatio, forceRecalculate, smoothFWHM, snapHsmlForStars, alsoSFRgasForStars, excludeSubhaloFlag, skipCellIndices, ptRestrictions, weightField, randomNoise, autoLimits)

Generate 3-band RGB composite using starlight in three different passbands. Work in progress.

loadMassAndQuantity(sP, partType, partField, rotMatrix, rotCenter, method, weightField, indRange=None)

Load the field(s) needed to make a projection type grid, with any unit preprocessing.

gridBox(sP, method, partType, partField, nPixels, axes, projType, projParams, boxCenter, boxSizeImg, hsmlFac, rotMatrix, rotCenter, remapRatio, forceRecalculate=False, smoothFWHM=None, snapHsmlForStars=False, alsoSFRgasForStars=False, excludeSubhaloFlag=False, skipCellIndices=None, ptRestrictions=None, weightField='mass', randomNoise=None, **kwargs)

Caching gridding/imaging of a simulation box.