forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnid.rb
122 lines (104 loc) · 3.68 KB
/
snid.rb
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
class Snid < Formula
homepage "http://people.lam.fr/blondin.stephane/software/snid"
url "http://people.lam.fr/blondin.stephane/software/snid/snid-5.0.tar.gz"
sha256 "22199803971fdd1bb394a550e81da661bd315224827373aae67408166873ec5c"
revision 2
bottle do
cellar :any
sha256 "0ec373a313ba1961806f28bb46217786f0010c37e95261d664b46336b7a83af9" => :yosemite
sha256 "855d5fe8b71e8d9f2ad2b4ae9dbc21f7f736e40e0ec8d3ded403530b5176f877" => :mavericks
sha256 "3cb5fe729d14efdc2ec972e5e224141be7cb5564c09cfa68598da67e1441016a" => :mountain_lion
end
depends_on :x11
depends_on :fortran
depends_on "homebrew/x11/pgplot" => "with-button"
resource "templates" do
url "http://people.lam.fr/blondin.stephane/software/snid/templates-2.0.tgz"
sha256 "c4bbe8795bd48dc21d707bfcb84e09ca5dca84034e54659523478a61571663db"
end
resource "bsnip_templates" do
url "http://hercules.berkeley.edu/database/BSNIPI/bsnip_v7_snid_templates.tar.gz"
sha256 "e3db3a08667c9adc4ab826b2a10f0d2a48010b81cb9418875df5f23c0cba9605"
version "7"
end
# no libbutton compilation and patch for new templates
# as per http://people.lam.fr/blondin.stephane/software/snid/README_templates-2.0
patch :DATA
def install
# new templates
resource("templates").stage { prefix.install "../templates-2.0" }
# BSNIP
resource("bsnip_templates").stage do
safe_system "ls *.lnw > templist"
cp "#{buildpath}/templates/texplist", "."
cp "#{buildpath}/templates/tfirstlist", "."
(prefix + "templates_bsnip_v7.0").install Dir["*"]
end
cp "source/snid.inc", "."
# where to store spectral templates
inreplace "source/snidmore.f", "INSTALL_DIR/snid-5.0/templates", "#{prefix}/templates-2.0"
ENV.append "FCFLAGS", "-O -fno-automatic"
ENV["PGLIBS"] = "-Wl,-framework -Wl,Foundation -L#{Formula["pgplot"].opt_lib} -lpgplot"
system "make"
bin.install "snid", "logwave", "plotlnw"
prefix.install "templates", "test"
doc.install Dir["doc/*"]
end
test do
system "#{bin}/snid", "inter=0", "plot=0", "#{prefix}/test/sn2003jo.dat"
assert File.exist?("sn2003jo_snid.output")
assert File.exist?("snid.param")
end
end
__END__
--- a/Makefile
+++ b/Makefile
@@ -167,12 +167,11 @@ OUTILS2= utils/lnb.o utils/median.o
OUTILS3= utils/four2.o utils/lnb.o
# Button library
-BUTTLIB= button/libbutton.a
+BUTTLIB= -lbutton
all : snid logwave plotlnw
snid : $(OBJ1) $(OUTILS1)
- cd button && $(MAKE) FC=$(FC)
$(FC) $(FFLAGS) $(OBJ1) $(OUTILS1) $(XLIBS) $(BUTTLIB) $(PGLIBS) -o $@
logwave : $(OBJ2) $(OUTILS2)
--- a/source/typeinfo.f
+++ b/source/typeinfo.f
@@ -48,6 +48,8 @@
typename(1,4) = 'Ia-91bg'
typename(1,5) = 'Ia-csm'
typename(1,6) = 'Ia-pec'
+ typename(1,7) = 'Ia-99aa'
+ typename(1,8) = 'Ia-02cx'
* SN Ib
typename(2,1) = 'Ib'
typename(2,2) = 'Ib-norm'
@@ -70,6 +72,8 @@
typename(5,3) = 'Gal'
typename(5,4) = 'LBV'
typename(5,5) = 'M-star'
+ typename(5,6) = 'C-star'
+ typename(5,7) = 'QSO'
return
end
--- a/source/snid.inc
+++ b/source/snid.inc
@@ -44,16 +44,16 @@
parameter (MAXPARAM = 200)
parameter (MAXPEAK = 20)
parameter (MAXPLOT = 20)
- parameter (MAXPPT = 20000)
+ parameter (MAXPPT = 50000)
parameter (MAXR = 999.9)
parameter (MAXRLAP = 999)
parameter (MAXSN = 300)
parameter (MAXUSE = 30)
- parameter (MAXTEMP = 3000)
+ parameter (MAXTEMP = 10000)
parameter (MAXTOK = 32)
parameter (MAXWAVE = 10000)
parameter (NT = 5)
- parameter (NST = 6)
+ parameter (NST = 8)
character*10 typename(NT,NST) ! character array containing type/subtype names