-
Notifications
You must be signed in to change notification settings - Fork 0
/
sythesize_images.jl
65 lines (46 loc) · 1.67 KB
/
sythesize_images.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import YAML
config = YAML.load(open("config.yaml"))
# Points at which to create images
parameters = readdlm("parameters.dat")
parnames = config["emulator"]["parameters"]
# Go through each of these and plot images, saving with the filename `image_001.out` etc,
# where each index corresponds to the line number in the parameters file.
using DiskJockey.constants
using DiskJockey.model
using DiskJockey.visibilities
using HDF5
grd = config["grid"]
grid = Grid(grd)
# Load the parameters file from the configuration setting, and make this an object.
pars = convert_dict(config["parameters"], config["model"])
vel = pars.vel # [km/s]
npix = config["npix"] # number of pixels
species = config["species"]
transition = config["transition"]
lam0 = lam0s[species*transition]
model = config["model"]
write_grid("", grid)
# Iterate over rows
for i in 1:size(parameters,1)
row = parameters[i,:]
println("processing ", row)
# Frequency will always be the first parameter
nu, incl = row
# Write out the Frequency to synthesize at
lam = cc./(nu * 1e9) * 1e4 # [μm]
write_lambda([lam], "")
# Update the parameters
pars.incl = incl
# Write the RADMC input files
write_model(pars, "", grid, species)
# Perform the synthesis and save it
(sizeau_desired, sizeau_command) = size_au(config["size_arcsec"], pars.dpc, grid) # [AU]
tic()
run(`radmc3d image incl $(pars.incl) posang $(pars.PA) npix $npix loadlambda sizeau $sizeau_command`)
println("Synthesis runtime")
toc()
# Copy image.out to a new filename
out = @sprintf("image_%3.3i.out", i)
cp("image.out", "images/" * out, remove_destination=true)
println("Finished ", pars)
end