-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd_noise.py
executable file
·36 lines (28 loc) · 1.01 KB
/
add_noise.py
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
from modules.pymcfost import pymcfost
#from multiprocessing import Pool
import os, shutil
# Define the directory
directory = '../Output/S2_Final/Moment/'
filename = 'pseudo_casa.fits'
# Define the parameters of the simulated data model
Delta_v = 0.1
iTrans = 0
bmaj = 0.15
bmin = 0.15
bpa = -38
convulations = 2
# Create a list model using the Moment data
model = pymcfost.Line('../Output/S2_Final/Moment/')
model.P.mol.nv = model.nv/convulations
# Define CPUS
#num_cpu = 4 # int(os.environ['SLURM_NTASKS'])*int(os.environ['SLURM_CPUS_PER_TASK'])
#pool = Pool(num_cpu)
# These arguments can be added online with a forked branch from pymcfost
pymcfost.pseudo_CASA_simdata(model, Delta_v=Delta_v, iTrans=iTrans, bmaj=bmaj, bmin=bmin, bpa=bpa, subtract_cont=True, SNR=5)
# Move the file from the directory
try: os.remove(directory + filename)
except: pass
shutil.move("CASA/" + filename, directory)
os.rmdir("CASA")
# Print the complete information
print("Noise Data Complete on Line Data. Moved to %s%s." % (directory, filename))