forked from ska-sa/homebrew-tap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
psrchive.rb
213 lines (184 loc) · 7.61 KB
/
psrchive.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
class Psrchive < Formula
homepage "http://psrchive.sourceforge.net/"
url "https://downloads.sourceforge.net/psrchive/psrchive-2012-12.tar.gz"
version "2012-12"
sha256 "0ca685b644eae34cac6dcbbc56b3729f58d334cee94322b38ec98d26c8b9bb71"
depends_on :x11
depends_on :fortran
depends_on "pgplot"
depends_on "fftw"
depends_on "cfitsio"
stable do
# 1. Add missing include for mem_fun and bind2nd
# 2. Use 'template' keyword to treat 'get' as a dependent template name
# 3 - 6. Fix unqualified lookup in templates for overloaded operators
# 7. Put default arguments in function declaration only
patch :DATA
end
head do
url "git://git.code.sf.net/p/psrchive/code"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
patch :DATA
end
def install
ENV.deparallelize
# Force clang to use the old standard library for now (solves issue with mutex type)
ENV.append "CXXFLAGS", "-stdlib=libstdc++" if ENV.compiler == :clang
system "./bootstrap" if build.head?
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system bin/"psrchive", "--version"
end
end
# diff --git a/Util/genutil/templates.h b/Util/genutil/templates.h
# index 88ce0fc..a8e2952 100644
# --- a/Util/genutil/templates.h
# +++ b/Util/genutil/templates.h
# @@ -11,6 +11,7 @@
# #include <algorithm>
# +#include <functional>
# #include <iterator>
# #include <vector>
#
# #include <assert.h>
# #include <string.h>
# --- a/Base/Formats/PSRFITS/setup_profiles.h
# +++ b/Base/Formats/PSRFITS/setup_profiles.h
# @@ -32,7 +32,7 @@ void setup_profiles_dat (I subint, P& profiles)
# template<class E, typename I, typename P>
# void setup_profiles (I subint, P& profiles)
# {
# - E* ext = subint->get_Profile(0,0)->Pulsar::Profile::get<E>();
# + E* ext = subint->get_Profile(0,0)->template get<E>();
# if (!ext)
# throw Error (InvalidState, "setup_profiles<Extension>",
# "first profile is missing required Extension");
# @@ -44,7 +44,7 @@ void setup_profiles (I subint, P& profiles)
#
# for (unsigned ichan=0; ichan<nchan; ichan++)
# {
# - ext = subint->get_Profile(0,ichan)->Pulsar::Profile::get<E>();
# + ext = subint->get_Profile(0,ichan)->template get<E>();
# if (!ext)
# throw Error (InvalidState, "setup_profiles<Extension>",
# "profile[%u] is missing required Extension", ichan);
__END__
diff --git a/Util/genutil/Types.h b/Util/genutil/Types.h
index 78a0154..13f10dd 100644
--- a/Util/genutil/Types.h
+++ b/Util/genutil/Types.h
@@ -123,16 +123,16 @@ namespace Signal {
//! Returns the state resulting from a pscrunch operation
State pscrunch (State state);
-}
+ std::ostream& operator<< (std::ostream& ostr, Signal::Source source);
+ std::istream& operator>> (std::istream& is, Signal::Source& source);
-std::ostream& operator << (std::ostream& ostr, Signal::Source source);
-std::istream& operator >> (std::istream& is, Signal::Source& source);
+ std::ostream& operator<< (std::ostream& ostr, Signal::State state);
+ std::istream& operator>> (std::istream& is, Signal::State& state);
-std::ostream& operator << (std::ostream& ostr, Signal::State state);
-std::istream& operator >> (std::istream& is, Signal::State& state);
+ std::ostream& operator<< (std::ostream& ostr, Signal::Scale scale);
+ std::istream& operator>> (std::istream& is, Signal::Scale& scale);
-std::ostream& operator << (std::ostream& ostr, Signal::Scale scale);
-std::istream& operator >> (std::istream& is, Signal::Scale& scale);
+}
/* note that Basis extraction and insertion operators are defined in
Conventions.h */
diff --git a/Util/genutil/Types.C b/Util/genutil/Types.C
index 682c29e..470d8ba 100644
--- a/Util/genutil/Types.C
+++ b/Util/genutil/Types.C
@@ -232,12 +232,12 @@ Signal::State Signal::string2State (const string& ss)
"Unknown state '" + ss + "'");
}
-std::ostream& operator<< (std::ostream& ostr, Signal::State state)
+std::ostream& Signal::operator << (std::ostream& ostr, Signal::State state)
{
return ostr << State2string(state);
}
-std::istream& operator >> (std::istream& is, Signal::State& state)
+std::istream& Signal::operator >> (std::istream& is, Signal::State& state)
{
return extraction (is, state, Signal::string2State);
}
@@ -294,12 +294,12 @@ Signal::Source Signal::string2Source (const string& ss)
"Unknown source '" + ss + "'");
}
-std::ostream& operator<< (std::ostream& ostr, Signal::Source source)
+std::ostream& Signal::operator << (std::ostream& ostr, Signal::Source source)
{
return ostr << Source2string(source);
}
-std::istream& operator >> (std::istream& is, Signal::Source& source)
+std::istream& Signal::operator >> (std::istream& is, Signal::Source& source)
{
return extraction (is, source, Signal::string2Source);
}
@@ -353,12 +353,12 @@ Signal::Scale Signal::string2Scale (const string& ss)
"Unknown scale '" + ss + "'");
}
-std::ostream& operator<< (std::ostream& ostr, Signal::Scale scale)
+std::ostream& Signal::operator << (std::ostream& ostr, Signal::Scale scale)
{
return ostr << Scale2string(scale);
}
-std::istream& operator >> (std::istream& is, Signal::Scale& scale)
+std::istream& Signal::operator >> (std::istream& is, Signal::Scale& scale)
{
return extraction (is, scale, Signal::string2Scale);
}
diff --git a/Util/tempo/Pulsar/Predictor.h b/Util/tempo/Pulsar/Predictor.h
index 7e774ee..c0cd789 100644
--- a/Util/tempo/Pulsar/Predictor.h
+++ b/Util/tempo/Pulsar/Predictor.h
@@ -99,10 +99,10 @@ namespace Pulsar {
};
-}
+ std::ostream& operator<< (std::ostream& ostr, Pulsar::Predictor::Policy p);
-std::ostream& operator<< (std::ostream& ostr, Pulsar::Predictor::Policy p);
+ std::istream& operator>> (std::istream& istr, Pulsar::Predictor::Policy& p);
-std::istream& operator>> (std::istream& istr, Pulsar::Predictor::Policy& p);
+}
#endif
diff --git a/Util/resources/Generator_default.C b/Util/resources/Generator_default.C
index 3df6f76..33117b8 100644
--- a/Util/resources/Generator_default.C
+++ b/Util/resources/Generator_default.C
@@ -13,7 +13,7 @@
using namespace std;
-std::ostream& operator<< (std::ostream& ostr, Pulsar::Predictor::Policy p)
+std::ostream& Pulsar::operator<< (std::ostream& ostr, Pulsar::Predictor::Policy p)
{
if (p == Pulsar::Predictor::Input)
return ostr << "input";
@@ -27,7 +27,7 @@ std::ostream& operator<< (std::ostream& ostr, Pulsar::Predictor::Policy p)
return ostr;
}
-std::istream& operator>> (std::istream& istr, Pulsar::Predictor::Policy& p)
+std::istream& Pulsar::operator>> (std::istream& istr, Pulsar::Predictor::Policy& p)
{
std::string policy;
istr >> policy;
diff --git a/Base/Formats/PSRFITS/setup_profiles.h b/Base/Formats/PSRFITS/setup_profiles.h
index 29fa2f2..f6bdaae 100644
diff --git a/Util/genutil/RobustStats.h b/Util/genutil/RobustStats.h
index 6be7634..cd5424a 100644
--- a/Util/genutil/RobustStats.h
+++ b/Util/genutil/RobustStats.h
@@ -126,7 +126,7 @@ T f_pseudosigma ( T f_spread )
* @param[in] Tukey_tune is the tuning constant for the influence function (Tukey's biweight in this case). This affects the efficiency of the estimator. The optimal value is 6.0 (i.e. include data up to 4 sigma away from the mean (Data analysis and regression, Mosteller and Tukey 1977)
*/
template<typename T>
-T robust_stddev ( T * data, unsigned size, T initial_guess, T initial_guess_scale = 1.4826, T Tukey_tune = 6.0 )
+T robust_stddev ( T * data, unsigned size, T initial_guess, T initial_guess_scale, T Tukey_tune )
{
vector<T> input;
input.resize ( size );