SPARX https://charms.asiaa.sinica.edu.tw/sparx/ Simulation Package for Astronomical Radiative Xfer Mon, 23 Apr 2018 09:10:06 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 https://charms.asiaa.sinica.edu.tw/sparx/wp-content/uploads/2017/10/icon-150x150.png SPARX https://charms.asiaa.sinica.edu.tw/sparx/ 32 32 Post-Processing: Continuum map https://charms.asiaa.sinica.edu.tw/sparx/2018/04/19/post-processing-continuum-map/ Thu, 19 Apr 2018 06:13:33 +0000 https://charms.asiaa.sinica.edu.tw/sparx/?p=443 The task “task_contobs” is for generating continuum image. A “wavelen” flag has to be specified by the simulated wavelength, of which the unit could be “A”, “nm”, “um”, “mm”, “cm”, “m” etc. $ sparx run task_contobs \ source=model out=cont_map \…

The post Post-Processing: Continuum map appeared first on SPARX.

]]>
The task “task_contobs” is for generating continuum image. A “wavelen” flag has to be specified by the simulated wavelength, of which the unit could be “A”, “nm”, “um”, “mm”, “cm”, “m” etc.


$ sparx run task_contobs \
source=model out=cont_map \
dist='1kpc' \
cell="['1asec', '1asec']" npix="[100,100]" \
chan="[64,'0.05kms^-1']" wavelen='850um' 

The post Post-Processing: Continuum map appeared first on SPARX.

]]>
Post-processing: Viewing the image and tau map https://charms.asiaa.sinica.edu.tw/sparx/2018/04/18/post-processing-viewing-image-using-miriad/ Wed, 18 Apr 2018 06:15:46 +0000 https://charms.asiaa.sinica.edu.tw/sparx/?p=433 Viewing the image by using MIRIAD The MIRIAD image would be generated if MIRIAD is installed while compiling SPARX. Once the image is produced, the channel map could be checked out by using the command. $ cgdisp in=MAPFILE device=/xs options=wedge,3val…

The post Post-processing: Viewing the image and tau map appeared first on SPARX.

]]>
Viewing the image by using MIRIAD

The MIRIAD image would be generated if MIRIAD is installed while compiling SPARX. Once the image is produced, the channel map could be checked out by using the command.


$ cgdisp in=MAPFILE device=/xs options=wedge,3val csize=1,1 range=,,lin,3

Use the command for image convolution.


$ convol map=MAPFILE beam=BEAMSIZE out=OUTFILE

View the spectra by the command.


$ imspec in=OUTFILE device=/xs region='rel,box(0,0,0,0)' csize=1,1

tau (optical depth) map

The “tau=TAU_FILENAME” flag can generate the optical depth image and can be used in the radiation-related tasks which include task_lineobs, task_contobs, and task_zeeman.

The post Post-processing: Viewing the image and tau map appeared first on SPARX.

]]>
Post-processing: Line imaging / LTE line imaging https://charms.asiaa.sinica.edu.tw/sparx/2018/04/17/post-processing-line-imaging/ Tue, 17 Apr 2018 09:26:11 +0000 https://charms.asiaa.sinica.edu.tw/sparx/?p=423 To generate the molecular line image, we should specify the line ID. For an example $ sparx run task_lineobs \ source=pops out=map \ dist='1kpc' \ cell="['1asec', '1asec']" npix="[100,100]" \ chan="[64,'0.05kms^-1']" line=0 sparx: Key 'overlap' not given, using default="0kms^-1" sparx: Key…

The post Post-processing: Line imaging / LTE line imaging appeared first on SPARX.

]]>
To generate the molecular line image, we should specify the line ID.

For an example

$ sparx run task_lineobs \
source=pops out=map \
dist='1kpc' \
cell="['1asec', '1asec']" npix="[100,100]" \
chan="[64,'0.05kms^-1']" line=0

sparx: Key 'overlap' not given, using default="0kms^-1"
sparx: Key 'lte' not given, using default="False"
sparx: Key 'excit' not given, using default="False"
sparx: Key 'unit' not given, using default="JY/PIXEL"
sparx: Key 'rotate' not given, using default="['0deg', '0deg', '0deg']"
sparx: Key 'vis' not given, using default="False"
sparx: Wrote FITS image to `map'

Generating LTE image is like normal line image routine but with “lte=’True'” flag. The input file could be a pure model or the population file containing the model.


$ sparx run task_lineobs \
source=model out=lte_map \
dist='1kpc' \
cell="['1asec', '1asec']" npix="[100,100]" \
chan="[64,'0.05kms^-1']" line=0 lte='True'

The post Post-processing: Line imaging / LTE line imaging appeared first on SPARX.

]]>
Post-processing: General flag https://charms.asiaa.sinica.edu.tw/sparx/2018/04/17/post-processing-general-flag/ Tue, 17 Apr 2018 09:22:33 +0000 https://charms.asiaa.sinica.edu.tw/sparx/?p=416 The common options of the image-mapping process contains the names of I/O files source The input HDF file name. The input file could be population data or the pure model data when operating LTE / continuum / column density mapping…

The post Post-processing: General flag appeared first on SPARX.

]]>

The common options of the image-mapping process contains the names of I/O files

source

The input HDF file name.
The input file could be population data or the pure model data when operating LTE / continuum / column density mapping

out

The output FITS file name.

to set up the observing position by the distance and the rotation of the model by the two flags

dist

The distance, on x-direction, of the observing point from the model. e.g. ‘1kpc’

rotate

Three arguments of angular parameter to rotate the model counter-clockwise sequentially by x-, y-, z-axis of the model’s coordinate

to set up the resolution and the configuration of the map by the flags:

cell

The angular size of one pixel cell

npix

The number of the pixels

subres

The sub-sampling of some specific region

For molecular line and Zeeman image

line

The index of molecular line transition

lte

LTE or non-LTE option

chan

The resolution and the range of the velocity channel

For continuum image

wavelen

The wavelength of the radiation

The post Post-processing: General flag appeared first on SPARX.

]]>
The Post-processing : Image Generation https://charms.asiaa.sinica.edu.tw/sparx/2018/04/17/post-processing-image-generation/ Tue, 17 Apr 2018 08:30:44 +0000 https://charms.asiaa.sinica.edu.tw/sparx/?p=410 There are the post-processing tools to yield non-LTE/LTE molecular line or Zeeman effect (Stokes V) image, the continuum emission map, and the column density image. SPARX provides four types of command : “task_lineobs”, “task_zeeman”, “task_contobs”, and “task_coldens”. Check the usage…

The post The Post-processing : Image Generation appeared first on SPARX.

]]>
There are the post-processing tools to yield non-LTE/LTE molecular line or Zeeman effect (Stokes V) image, the continuum emission map, and the column density image. SPARX provides four types of command : “task_lineobs”, “task_zeeman”, “task_contobs”, and “task_coldens”.
Check the usage of the specific task by using sparx help

$ sparx help task_lineobs

Name:
  task_lineobs

Description:
  Synthetic line map generator

Keywords:
        line=Index
             (No default)
             Line index of observing line
        
        ...

The post The Post-processing : Image Generation appeared first on SPARX.

]]>
The non-LTE solver : AMC https://charms.asiaa.sinica.edu.tw/sparx/2018/04/17/non-lte-solver-amc/ Tue, 17 Apr 2018 08:29:05 +0000 https://charms.asiaa.sinica.edu.tw/sparx/?p=407 The solver “task_amc”, named by the algorithm AMC (advanced Monte-Carlo method), is used for solving non-LTE molecular level populations. The user can check the command options by using “sparx help” with the task name $ sparx help task_amc Name: task_amc…

The post The non-LTE solver : AMC appeared first on SPARX.

]]>
The solver “task_amc”, named by the algorithm AMC (advanced Monte-Carlo method), is used for solving non-LTE molecular level populations.
The user can check the command options by using “sparx help” with the task name

$ sparx help task_amc

Name:
  task_amc

Description:
  Non-LTE molecular excitation solver

Keywords:
      source=OldFile
             (No default)
             Name of input source model (HDF5 file)

         out=NewFile
             (No default)
             Name of output file (HDF5 file)
        ...

Commonly used options
source : input HDF file of the model
out       : output HDF file containing physical model and molecular population
pops    : initial population file
lte        : initial condition.
The value ‘True’ is for LTE assumption, ‘False’ for ground state distribution. The default is ‘True’
trace   : the switch to record the result of every step during the iteration. The default is ‘False’
snr      : demanding signal-noise-ratio. The default is 20.

$ sparx run task_amc source=model out=pops

sparx: Key 'overlap' not given, using default="0kms^-1"
sparx: Key 'lte' not given, using default="True"
...
sparx: Model geometry is 'sph1d'
sparx: Solving excitation for HCO+
sparx: Total 21 levels, 20 lines
sparx: Beginning convergence from LTE conditions
sparx: 
sparx: Iterating for convergence with FIXED set of random rays, Quasi Random Ray
sparx:  Iter.|Converged/Total|   Prcntg.| Max diff.|      Goal|  Elapsed|              Status
sparx: ------|---------------|----------|----------|----------|---------|--------------------
sparx:      1|      0/64     |     0.00%|7.8786e+03|5.0000e-03|000:00:00|->        64000 rays
sparx:      2|      0/64     |     0.00%|8.4630e+00|5.0000e-03|000:00:00|->        64000 rays
sparx:      3|      0/64     |     0.00%|5.3358e-01|5.0000e-03|000:00:00|->        64000 rays
...
      Converged!
sparx: 
sparx: Iterating for convergence with FULLY RANDOM rays,  Quasi Random Ray
sparx:  Iter.|Converged/Total|   Prcntg.| Max diff.|      Goal|  Elapsed|              Status
sparx: ------|---------------|----------|----------|----------|---------|--------------------
sparx:      1|     64/64     |   100.00%|1.8172e-02|5.0000e-02|000:00:03|->        64000 rays
sparx:      2|     64/64     |   100.00%|4.2857e-02|5.0000e-02|000:00:04|->        91000 rays
sparx:      3|     64/64     |   100.00%|3.7657e-02|5.0000e-02|000:00:05|->        97000 rays
...
      Converged!
sparx: 
sparx: Iterating for convergence with FIXED set of random rays, Quasi Random Ray
sparx:  Iter.|Converged/Total|   Prcntg.| Max diff.|      Goal|  Elapsed|              Status
sparx: ------|---------------|----------|----------|----------|---------|--------------------
sparx:      1|     33/64     |    51.56%|2.8726e-02|5.0000e-03|000:00:18|->       193000 rays
sparx:      2|     64/64     |   100.00%|2.5680e-04|5.0000e-03|000:00:19|->       193000 rays
sparx:      3|     64/64     |   100.00%|4.6238e-05|5.0000e-03|000:00:20|->       193000 rays
sparx:      4|     64/64     |   100.00%|1.3234e-05|5.0000e-03|000:00:20|->       193000 rays
sparx:      5|     64/64     |   100.00%|3.0766e-06|5.0000e-03|000:00:21|->       193000 rays
      Converged!
sparx: Wrote output model to 'pops'

The flag “snr” controls the accuracy of AMC algorithm. The default SNR value 20 means the result of the level populations could contain maximally 5% error. The SNR value should be comparable to the target observational data you’d like to simulate. And the error of the model generated by finite element method should also be checked by enabling “-e” flag in PRESPARX stage.

The default program is multithreading with doubling the number of cores. The flag “–parallel” could enable MPI passage between nodes. An “MPIHOST” file should be specified. Use the command to run the parallel job.

$ mpirun -v -machinefile MPIHOST -np $NPROCS sparx ....

The post The non-LTE solver : AMC appeared first on SPARX.

]]>
The Preprocessor: PRESPARX https://charms.asiaa.sinica.edu.tw/sparx/2018/04/17/the-preprocessor-presparx/ Tue, 17 Apr 2018 08:26:59 +0000 https://charms.asiaa.sinica.edu.tw/sparx/?p=404 The command “presparx” can show the usage $ presparx presparx -o < Output File > -e : error estimation -p : profile plot -v : generate vtk file -o : the filename of the HDF data for SPARX input -e…

The post The Preprocessor: PRESPARX appeared first on SPARX.

]]>
The command “presparx” can show the usage

$ presparx
presparx -o < Output File >
         -e : error estimation 
         -p : profile plot
         -v : generate vtk file

-o : the filename of the HDF data for SPARX input
-e : estimate the error of mass and the largest velocity dispersion
-p : generate a simple plot of the physical profile
-v : generate the VTK file for visualization purpose

grid.py for an example of a spherical 1D uniform grid

# Grid Type : SPH1D / SPH3D / CYL3D /REC3D / REC1D
GridType = 'SPH1D'
# spacing type : uniform / stretch
spacing = 'uniform'
# resolution of the radius
nr = 64
# inner radius (pc)
Rin = 0.0
# outer radius (pc)
Rout = 0.1

model.py for an example of Shu’s 1D collapsing cloud

# Model Type : Function / Constant / TABLE / ZEUS 
ModelType = 'Function'

# Molecule
molec = 'hco+'
# CMB temperature (Kelvin, outer B.C.)
T_cmb = 2.73
# inner Boundary condition
T_in = 0.0
# reference radius
r_ref = 0.01
# reference H2 number density (m^-3)
n_H2_ref = 1e10
# reference velocity (m/s)
V_ref = -200.0

# Gas Density (number/m^3)
def Density1D(r):
        n_H2 = n_H2_ref * ( r / r_ref )**-2.
        return n_H2
class model:
        def __init__(self,r):
                # Gas Density (number/m^3)
                self.n_H2 = Density1D(r)
                # Velocity (m/s)
                self.Vr = V_ref * ( r / r_ref )**-0.5
                # Temperature (Kelvin)
                self.T_k = 10.
                # turbulent speed (m/s)
                self.Vt = 200.
                # Molecular Abundance (fraction)
                self.X_mol = 1e-9
                # dust-to-gas ratio
                self.dust_to_gas = 0.01
                # Dust Temperature (Kelvin)
                self.T_d = self.T_k
                # dust kappa
                self.kapp_d = 'table,jena_thin_e5'

Command “presparx” and specify the model file name.
Append “-epv” to check out the error, profile plot, and the VTK file

$ presparx -o model -epv
Analytical Mass : 0.103706 Msun
Mass Error of the Gridding : 0.640518 %
Largest Velocity Dispersion to Turbulent Velocity : 1.512118
Largest Dispersion occurs at spatial index = 0
profile.png generated
visual.vtk generated
wrote out "model"

The options “-p” and “-v” would generate a figure ‘profile.png’ and a VTK file ‘visual.vtk’. The profile of this model is shown as below
profile

The post The Preprocessor: PRESPARX appeared first on SPARX.

]]>