Mockspec

Full Pipeline

This project is maintained by jrvliet

Welcome to Mockspec

This is the main page for the mockspec code. This code generates and analyzes synthetic quasar absorption line profiles in the circumgalactic medium around galaxies simulated with ART. It has been developed by Jacob Vander Vliet and Dr. Chris Churchill at New Mexico State University. The full details of how the code works can be found: here and here.

Overview:

This code generates synthetic quasar absorption lines by running lines of sight (LOS) through a simulated galaxy made with ART. This repository has all the code required to generate and analyze the spectra.

Before you run the code:

There are a few steps that need to be taken before the code can be run.

  1. To run this code, the following python packages need to be installed:
    • numpy
    • pytables
    • panda
    • astropy
  2. Get the simulation in the correct format. ART output the entire simulation box, typically 10Mpc along a side. Mockspec does not run on these boxes. It instead runs on a small box selected from the large box. This selection is done using ANA. There are two versions of ANA. The following instructions are for the version written by Daniel Ceverino. Usually, you should use the second version. Daniel's version is found in funcs/ana/. Running ANA requires the following simulation files:
    • 10MpcBox_csf512.d
    • 10MpcBox_HartGal_csf_a0.300.d
    • 10MpcBox_HartGal_csf.d
    • PMcrda0.300.DAT
    • PMcrs0a0.300.DAT
    • sf.dat
    To control the run of ANA, there are two control file:
    • control.dat
    • schedule_R.dat
    Schedule_R.dat has most of the controls in it. The top section has flags as to what the code should read in and what files it should produce. The sections that definitely need to have a 1 are:
    • Read N-body file
    • Read stellar file
    • Read HYDRO file
    • Set units and global variables
    • Find halo center using particle distribution
    • Compute angular momentum
    • density, temperature, entropy profiles and Rvir calculation
    • Binary file with gas cells inside 4Rvir-box
    • Binary file with gas cells inside 4Rvir-box (metalliciites)

    ANA has an interesting behaviour where it finds the center of the galaxy, but is super bad at it. You need to find the center with Rockstar (found here and put it in manually. The Rockstar center is found in the halos* files and is the first halo listed. These files contain ALL the halos in the simulation, ordered by mass. Since we want the host galaxy, use the first line.

    The coordinates are put in on the lines "xuser", "yuser", "zuser". The flag in front of "ioptCenter=1/2/3-->potential/HF/IFRIT" should be set to 2, indicating the center is from a halo finder if the simulation is a VELA, or 1 (indicating the center is the location of maximum potential) if the simulation is a dwarf. This setting is the biggest source of uncertainty in ANA. Always check the output Mvir and Rvir against the value from Rockstar, which is recorded along with the centers. If they differ by a significant amount, change the setting of ioptcenter and try again.

    Line 30 of schedule_R.dat should be the single word 'test'. This is the prefix appended to the front of all files created by ANA. Change this to the galID, such as D9m4a or vela20v2.

    The rest of the file should not be touched.

    To setup control.dat, only change after the three repeated lines of "1. 129". The single number on the next line is the number of snapshots to run ANA on. Leave this as one. The rest of the file is the list of expansion parameters of the snapshots. Even if there are several numbers listed here, ANA will only run on the first one, since the number of snapshots to run is set to 1. Also, ensure the first line, labeled jobname1, is set to 10MpcBox_HartGal_csf. This is the large 10Mpc box that will be read.

    Once both control.dat and schedule_R.dat are set, run ana.R.exe. The file needed is the GZ file. The necessary output files are named <galID>_GZa<expansion parameter>.txt (the gas box) and summary.txt (summary file).

  3. To use the summary file, its contents need to be added to the galaxy's summary file. These files are named <galID>.dat and are located in the summaries directory. These properties are required for the rest of the pipeline, mainly cellfinder, to work. The rotation matrix a is one of the most important results from ANA and the main reason we still use it.
  4. The pipeline does not run on the binary files. It runs on an ASCII version of the file. To convert, use readbinary.exe. Run it with the format of

    readbinary.exe <binary file> <name of output ASCII file> GZ

    The name of the output ASCII file should be the name of the binary file, but with .dat replaced with .txt
  5. In most cases, Ceverino's version of ANA is not the version you should use. You should use the version written by Kenza Arraki. It is found in ana/justGZ/. Depending on the type of simulation you are analyzing, you may have to change some of the code. The line to look it is line 294 of ART_IO.F. It should look like:

    integer lspecies(nspec)

    If you are analyzing a Vela of the 4th generation, this needs to be changed to:

    integer*8 lspecies(nspec)

    The other change is to use the correct a_setup.h file. The justGZ directory has three available: Dwarf_a_setup.h, VELA_a_setup.h, VELA4_a_setup.h. Copy the one you are using to a_setup.h and make the code.

    To use this version, the directory has to be set up properly. There needs to be a directory called outputs in the location where you are running the code. This this directory there needs to be a directory called rockstar. There also needs to be find called input_.txt. This file is output by the Rockstar code.

    When the code is run, it will output the GZ box in ASCII into the output directory. It will be called _GZa.txt. There will also be a file called ioread.txt which is the screen output of ANA and a file called rotmat_a.txt. This contains the rotation matrix for the box.

  6. Configure the run. The parameters of the run are set in the mockspec.config file. There are three sections in this file. The first describes the galaxy and basic code parameters. These are mostly self-explanatory. The number of cores only affects the codes that can be run with parallization, namely cellfinder. The root location is not used by anything, so don't change it The second section determines which codes will be run. A 1 turns the code on, a 0 turns it off. The third section describes the ions to be probed and what instrument will be used for that ion.
  7. Ensure the directory has all required files, namely the galaxy file
  8. Make all compiled codes. This includes: rates, cellfinder, los7, specsynth, sysabs, and cullabs. To make rates, you need to download and untar the following files:

Running the code

The main driver is mockspec.py. Run this in the directory with the snapshot. Everything is controlled by the mockspec.config file.

Outputs

The code generates several files along the way:

Reading the Outputs

Most of the outputs are stored in the HDF5 file format. This format results in smaller output files that write and read faster than plain text and is the industry standard. To access the files, it is helpful to know the columns included in each file:

abs_cells:

ALL.sysabs:

Gasbox: