Research:Sunrise
From Astronomy Facility Wiki
Contents |
Overview
Sunrise is actually a suite of four (or, for v3, three) programs that produce as a final output a 2D "astronomical" image of an N-Body simulation that contains stars and gas. Each pixel contains the full REST FRAME flux SED of the sources along that line of sight. Sunrise includes a full treatment of dust reprocessing with radiative transfer. The four programs you will run in turn are
- sfrhist: Star formation history integration code. This module calculates the SEDs for the particles in you simulation.
- makegrid: Adaptive-refinement grid creation. The makegrid executable loads a snapshot file output by sfrhist and creates the adaptive-refinement grid. The output file describes the grid structure along with the luminosity and density in the grid cells. This module is not run separately in version 3.0 of Sunrise.
- mcrx: Radiative-transfer calculation. The mcrx executable is the actual radiative-transfer program. It does the ray tracing, both for the non-scattering stage and the scattering stage, and then the necessary postprocessing: calculating attenuation, interpolating over wavelength, adding the IR template, etc.
- broadband: Broadband color integration. The broadband executable takes the output from mcrx and integrates the data cubes into broadband color images. It also integrates the integrated SEDs into integrated magnitudes
Each of the executables takes a .config files as its parameter and outputs a .fits file.
Much of this text come from the Twiki Sunrise Page. Patrik Jonsson's documentation can be found at http://www.ucolick.org/~patrik/sunrise/. See either of these pages for more information.
Getting the Code
Sunrise is currently installed on:
- Sharks (version 2.55)
- Executables in /astro/users/patrik/altix/bin/
- Source Code in /astro/users/patrik/build-sunrise/sunrise/src
- SEDs and other libraries in /astro/users/patrik/dust_data/
- (Super-secret, modified versions in /astro/net/scratch2/christensen/Sunrise/build-sunrise/src)
- Elektra (version 2.55)
- Executables in /astro/apps/for/elektra/pkg/Sunrise/
- Source Code in /astro/apps/for/elektra/pkg/Sunrise/sunrise-2.55/
- SEDs and other libraries in /astro/apps/for/elektra/pkg/Sunrise/dust_data
- Robert (version 3.0 -- still buggy).
- Executables in /home/trq/src/build-sunrise/src/
- Source Code in /share/bigdisk1/PROJECTS/sunrise/bin/
- SEDs and other libraries in /share/bigdisk1/PROJECTS/sunrise/dust_data/
For code modified to incorporate redshift dimming, Lyman alpha absorption, or for non-cosmological expansion, email christensen <AT> astro <DOT> washington <DOT> edu
Build instructions for Sunrise for sharks are here. For more detailed instructions, ask Patrik Jonsson, Tom Quinn, Sarah Loebman of Charlotte Christensen.
Getting Started
You may either run Sunrise on Sharks, Elektra or on Robert. The first thing to do, therefore, is to get an account on one (or all!) of the computers. Email Tom Quinn trq@astro or Richard Coffey richardc@phys for this.
To start, you will need a tipsy ascii file of your simulation. There is a program floating around the astronomy department called bin2ascii which will handle this for you. If it is a disk like galaxy it is better if it is aligned with the xy axis so you may also want to realign your galaxy. Furthermore, if your galaxy is part of a larger cosmological simulation, you will want to use Amiga to pull out the part you are interested in. I hear Chris Brooks has some good code for this.
Move your new tipsy ascii file to the computer of your choice and get ready to roll.
Running on Sharks
On Sharks, Sunrise is compiled in /astro/users/patrik/altix/bin/sfrhist
Starting Off
Point Sunrise to the right libraries:
setenv LD_LIBRARY_PATH /net/intel/compiler91/lib:/astro/users/patrik/altix/lib:/users/trq/sunrise/lib setenv PYTHONPATH /astro/users/patrik/python
Also, go ahead and type
limit coredumpsize 0k
That way, the huge fits data structures won't be dumped as cores that will fill up our disks.
The rest of the Sharks tutorial is written so you can work along with it using one of Fabio's galaxies. Get the files this way:m
ftp ftp.astro.washington.edu user anonymous passwd your e-mail cd pub/users/fabio/ get MW1lr.tar.gz
In our example: MW1.256g1bwK.0051.30kpc.ascii is a TIPSY ascii file of a Milky Way like galaxy formed in a cosmological simulation. z=0
System units for the example run are:
L 28571kpc 8.81609e25 cm M 6.3071e48 g T 40.43Gyrs V 691 km/sec 6.91e7 cm/sec
sfrhist
The first file you will need is sfrhist.stub (no need to change anything here for different runs, but "max_radius". Documentation of parameters The second file sfrhist-snapshot.config is specific for each snapshot. Take units from the N-body run. m_star_creation is from the line:
dInitStarMass = 7.630752e-10 #0.3 Original Gass Mass
in the simulation simulation.param file.
You will also need a linked file in TIPSY ascii format
ln -s existing_file new_file
and a smooth .h file. To build the .h file, you will need to run smooth on a tipsy standard file. If you don't already have such a file create the standard file:
ascii2std < file.asc >file.std
then run smooth:
./smooth -s 32g -o file hsmooth < file.std
now you can run it:
/astro/users/patrik/altix/bin/sfrhist sfrhist-MW1lr_001-001.config
this writes a fits file: MW1lr_001.fits. Usually if something goes wrong (Warning: 6 particles have negative ages! / youngest particle: -2.8464e+06) it is because snaptime is a tiny bit too small. Make sure you get the correct time In sim units) to many significant digits. sfrhist will take a few mins with the example file.
makegrid
To run makegrid you will need
- makegrid.stub basically leave it alone for now unless you know what you are doing. You may want to change the size/depth of the grid. Documentation or parameters.
- makegrid-MW1lr_001.config
to run:
/astro/users/patrik/altix/bin/makegrid makegrid-MW1lr_001.config
this writes a fits file: grid_MW1lr_001.fits makegrid will take a few minutes to complete with the example file.
mcrx
To do the dust reprocessing
- mcrx.stub This where the camera angles and the ray tracing precision get set. To start with, just leave it on. Once you are feeling adventuresome, though, see below for an example of how to change it. Documentation of parameters.
- mcrx-MW1lr_001.config
to run:
/astro/users/patrik/altix/bin/mcrx mcrx-MW1lr_001.config
This writes mcrx_MW1lr_001.fits, a big file that contains the pixel by pixel SED of the image
Playing with mcrx.stub
ntheta 4 nphi 1 exclude_south_pole true
ntheta sets the number of theta points. if the south pole option is false, there will be one point on the north and south pole respectively. If it's true, the points will be distributed AS IF there were n+1 theta points, but the last one on the south pole won't be there. This is to avoid always making redundant views from the +-z axis. Note that this step can be repeated for different Fields of View, without starting all over. Just rerun mcrx for however many fields of view you want. Simply change the camerfov value in mcrx.stub. I am pretty sure that this is actually in kpc, (it says [rad]) (ie a value of camerfov = 100 gives a box with sides of 100kpc) Note that the mcrx.xxx.fits file has information about the pixel size... under the HEADER for CAMERA0....
broadband
This final step makes broadband images of our simulations in several filters
- broadband.stubDon't worry about changing this Documentation of Parameters
- broadband-MW1lr_001.config
run:
/astro/users/patrik/altix/bin/broadband broadband-MW1lr_001.config
More Options
It is possible to create broadband images of a galaxy that incorporates redshift and luminosity dimming for a given z. To do this, add the following line to your broadband.config file:
Redshift z
where "z" is the numerical value of the redshift of the galaxy. This will result in images in which the wavelengths have been lengthen by (1+z) and the luminosity has been dimmed by 1/(1+z)^2. The best way to incorporate redshift into the full SED produced by mcrx.cc is to do post processing to shift the wavelengths and dim the luminosity
You can also include lyman absorption by intervening galaxies by putting the following line in your broadband.config file
Lyman_Absorption 1
Making Pretty Pictures -- Because observational astronomers shouldn't have all the fun
It is possible to make composite images stacking different filters together. This assigns red blue and green to three filters of your choice, and stacks the images. The method employed follows closely those used in Lupton et al. (2004 PASP, 116 133, astro-ph/0312483). This is also the technique used by Andrew West in generating these images:
http://www.astro.washington.edu/west/
We will use an IDL routine for this... You can get this at: /astro/net/scratch1/cbrook/idl/sunriseImages/west_mimic.pro. You will also need : /astro/net/scratch1/cbrook/idl/sunriseImages/find_hdu.pro This has several inputs, which you do not need to change, but are certainly free to play around with if you want to witness the effects.. for full explanations, see the Lupton paper above... here we just provide a "howto".
compile west_mimic, then run
west_all,'broadband_MW1hr',[0,5],.2,9,0,/save,start_hdu="CAMERA0-BROADBAND"
this makes color images of all the "broadband_MW1hr_xxx.fits" files, using cameras 0-5. Note, this means Scatter Cameras 0,1,2 and Non-Scatter (ie without dust), Cameras 0,1,2.. of course if you have added more camera angles above then this range increases.
The code will ask you which bands you want to use for rgb colors, and provide a list with corresponding numbers. SDSS i,r,g bands for rgb is a good option for this.. also HST ACS F775, 606 and 435 makes a decent combination..... Just type the relevant numbers, 5,4,3 or 9,8,7 for these cases... It is rudimentary to edit the IDL code slightly to allow combinations of 5 bands... eg
red = ((i_band)+(z_band))*scale[0] green = ((r_band))*scale[1] blue = ((g_band)+(u_band))*scale[2]
optional input scale=scales: this will change the weight given to r,g,b.. default is equal weighting
.2,9,0 are stretch parameters, you can play with them for your purpose, but these numbers seem reasonable . The .2 is the linear stretch in the faint areas and the 9 is a softening in bright areas. keep the 0 0. (please, see Lupton for full explanation)
/save input will write jpg images in a directory called ./color
Running on Robert
To run Sunrise on Robert, you will need to go through the same steps as on Sharks: sfrhist, makegrid, mcrx and broadband. Again, each module will take a .config file as its parameter and output a .fits file. The only differences is that on Robert, Sunrise is in /share/bigdisk1/PROJECTS/sunrise. Your library paths will now be /share/bigdisk1/PROJECTS/sunrise/lib and the executables live in /share/bigdisk1/PROJECTS/sunrise/bin.
On-Going Modifications
I have added parameters to the broadband module to include redshift and lyman absorption. The next step is a function to read Research:Tipsy bin files -- Charlotte Christensen 9/6/07
