forked from keflavich/APEX_CMZ_H2CO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_data_release.py
97 lines (89 loc) · 4.87 KB
/
make_data_release.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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
"""
Copy data from the appropriate directories to the CDS directory for upload to A&A
"""
import os
from paths import h2copath,figurepath,hpath,rpath,fpath,mpath,molpath,tpath
import tarfile
integrated_files = [hpath(x) for x in ('APEX_H2CO_303_202_masked_moment0.fits',
'APEX_H2CO_303_202_masked_smooth_moment0.fits',
'APEX_H2CO_321_220_masked_moment0.fits',
'APEX_H2CO_321_220_masked_smooth_moment0.fits',
"H2CO_321220_to_303202_bl_integ.fits",
"H2CO_321220_to_303202_bl_integ_weighted.fits",
"H2CO_321220_to_303202_bl_integ_masked_weighted.fits",
"H2CO_321220_to_303202_bl_integ_temperature_dens1e4.fits",
"H2CO_321220_to_303202_bl_integ_temperature_dens1e4_abund1e-10.fits",
"H2CO_321220_to_303202_bl_integ_temperature_dens1e4_abund1e-8.fits",
"H2CO_321220_to_303202_bl_integ_temperature_dens1e5.fits",
"H2CO_321220_to_303202_bl_integ_temperature_dens3e4.fits",
"H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e4.fits",
"H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e4_abund1e-10.fits",
"H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e4_abund1e-8.fits",
"H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e5.fits",
"H2CO_321220_to_303202_bl_integ_weighted_temperature_dens3e4.fits",
"pv_H2CO_321220_to_303202_bl_integ_masked_weighted_temperature_dens1e4.fits",
"pv_H2CO_321220_to_303202_bl_integ_masked_weighted_temperature_dens1e4_abund1e-10.fits",
"pv_H2CO_321220_to_303202_bl_integ_masked_weighted_temperature_dens1e4_abund1e-8.fits",
"pv_H2CO_321220_to_303202_bl_integ_masked_weighted_temperature_dens1e5.fits",
"pv_H2CO_321220_to_303202_bl_integ_masked_weighted_temperature_dens3e4.fits",
"pv_H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e4.fits",
"pv_H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e4_abund1e-10.fits",
"pv_H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e4_abund1e-8.fits",
"pv_H2CO_321220_to_303202_bl_integ_weighted_temperature_dens1e5.fits",
"pv_H2CO_321220_to_303202_bl_integ_weighted_temperature_dens3e4.fits",
)
]
cubes = [hpath(x)
for x in ("H2CO_321220_to_303202_cube_bl.fits",
"H2CO_321220_to_303202_cube_smooth_bl.fits",
"APEX_H2CO_303_202_bl.fits",
"APEX_H2CO_321_220_bl.fits",
"APEX_H2CO_322_221_bl.fits",
)
] + [mpath(x)
for x in ("APEX_13CO_2014_merge.fits",
"APEX_C18O_2014_merge.fits",
"APEX_H2CO_merge_high_plait_all.fits",
)
] + [molpath(x)
for x in
("APEX_SiO_54_bl.fits",)
]
dendrograms = [hpath(x) for x in
("DendroMask_H2CO303202.hdf5",)
] + [tpath(x) for x in
("fitted_line_parameters_Chi2Constraints.ipac",
"PPV_H2CO_Temperature.ipac",
)
]
if not os.path.isdir('cds'):
os.mkdir('cds')
if not os.path.isdir('cds/integrated'):
os.mkdir('cds/integrated')
if not os.path.isdir('cds/cubes'):
os.mkdir('cds/cubes')
if not os.path.isdir('cds/catalogs'):
os.mkdir('cds/catalogs')
for fn in integrated_files:
fullfn = os.path.realpath(fn)
shortfn = os.path.basename(fn)
outpath = os.path.join('cds/integrated', shortfn)
if not os.path.isfile(outpath):
print(fn,outpath)
os.link(fn, outpath)
for fn in cubes:
fullfn = os.path.realpath(fn)
shortfn = os.path.basename(fn)
outpath = os.path.join('cds/cubes', shortfn)
if not os.path.isfile(outpath):
print(fn,outpath)
os.link(fn, outpath)
for fn in dendrograms:
fullfn = os.path.realpath(fn)
shortfn = os.path.basename(fn)
outpath = os.path.join('cds/catalogs', shortfn)
if not os.path.isfile(outpath):
print(fn,outpath)
os.link(fn, outpath)
with tarfile.open('cds.tgz','w:gz') as tar:
tar.add('cds')