-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestcode.py
More file actions
63 lines (47 loc) · 1.73 KB
/
testcode.py
File metadata and controls
63 lines (47 loc) · 1.73 KB
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
import numpy as np
import glob, pickle
import os,inspect,sys
try:
libpath=os.environ['SESNPATH']
except KeyError:
print "must set environmental variable SESNPATH"
sys.exit()
cmd_folder = os.path.realpath(libpath+"/SESNCFAlib")
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
cmd_folder = os.path.realpath(libpath+"/SESNCFAlib/templates")
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
from snclasses import *
from templutils import *
import optparse
import pylabsetup
su=setupvars()
f=glob.glob(os.environ['SESNPATH']+"/finalphot/*05bf*[cf]")
assert len(f)>0, "no such SN in the data archive"
f=f[0]
##note: all files have extention .c or .f in cfa3 and cfa4
thissn=mysn(f)
fnir = True
lc,flux,dflux, snname = thissn.loadsn(f,fnir, verbose=True)
#assert snname.lower() in Vmax.keys(), "skipping object missing from metadata table %s"%snname.lower()
thissn.readinfofileall(verbose=False, earliest=False, loose=True)
thissn.setsn(thissn.metadata['Type'],thissn.Vmax)
thissn.setphot()
##look for galaxy extinction correction
myebmv=0
assert thisebmv=su.ebmvs[thissn.snnameshort], "couldnt find ebmv correction in
su=setupvars()"
try:
thisebmv+=su.ebmvhost[thissn.snnameshort]
except KeyError:
pass
#for snoff in su.ebmvs.iterkeys():
# if thissn.name.endswith((snoff.strip()).lower()):
# myebmv=su.ebmvs[snoff]
thissn.getphot(myebmv)
thissn.getcolors()
thissn.printsn(photometry=True, fout="sn05bf.phot.lcv")
thissn.printsn(color=True, fout="sn05bf_color.phot.lcv")
thissn.plotsn(photometry=True, offsets=True, aspect=0.5, Vmax=True, savepng=True, show=True, legendloc=2)
thissn.plotsn(color=True,show=True, offsets=True, aspect=0.5, Vmax=True, savepng=True)