4 #include <boost/lexical_cast.hpp> 20 (
const blitz::Array<double, 1>& Hres_wn,
21 const blitz::Array<double, 1>& Hres_rad,
22 const std::vector<int>& Pixel_list)
const 24 if(Hres_wn.rows() != Hres_rad.rows())
25 throw Exception(
"wave_number and radiance need to be the same size");
26 Array<double, 1> disp_wn(disp->pixel_grid().data());
28 Array<double,1> res((
int) Pixel_list.size());
29 for(
int i = 0; i < res.rows(); ++i) {
33 double wn_center = disp_wn(Pixel_list[i]);
34 Array<double, 1>::const_iterator itmin =
35 std::lower_bound(Hres_wn.begin(), Hres_wn.end(),
36 wn_center - ils_half_width_.value);
37 Array<double, 1>::const_iterator itmax =
38 std::lower_bound(Hres_wn.begin(), Hres_wn.end(),
39 wn_center + ils_half_width_.value);
40 int jmin = (itmin == Hres_wn.end() ? Hres_wn.rows() - 1 : itmin.position()(0));
41 int jmax = (itmax == Hres_wn.end() ? Hres_wn.rows() - 1 : itmax.position()(0));
46 ils_func->ils(wn_center, Hres_wn(r), response);
47 Array<double, 1> conv(response.value() * Hres_rad(r));
51 res(i) = integrate(Hres_wn(r), conv) /
52 integrate(Hres_wn(r), response.value());
62 double IlsConvolution::integrate(
const blitz::Array<double, 1>& x,
63 const blitz::Array<double, 1>& y)
const 66 for(
int i = 1; i < x.rows(); ++i)
67 res += (x(i) - x(i - 1)) * (y(i) + y(i - 1));
81 for(
int i = 1; i < x.rows(); ++i) {
82 double t = x(i) - x(i - 1);
84 resgrad += t * (y.
jacobian()(i, Range::all()) +
95 (
const blitz::Array<double, 1>& Hres_wn,
97 const std::vector<int>& Pixel_list)
const 99 firstIndex i1; secondIndex i2;
100 if(Hres_wn.rows() != Hres_rad.
rows())
101 throw Exception(
"wave_number and radiance need to be the same size");
104 std::max(disp_wn.number_variable(),
108 Array<double, 1> one(1);
110 Array<double, 1> normfact_grad(disp_wn.number_variable());
113 for(
int i = 0; i < res.
rows(); ++i) {
118 Array<double, 1>::const_iterator itmin =
119 std::lower_bound(Hres_wn.begin(), Hres_wn.end(),
120 wn_center.
value() - ils_half_width_.value);
121 Array<double, 1>::const_iterator itmax =
122 std::lower_bound(Hres_wn.begin(), Hres_wn.end(),
123 wn_center.
value() + ils_half_width_.value);
124 int jmin = (itmin == Hres_wn.end() ? Hres_wn.rows() - 1 : itmin.position()(0));
125 int jmax = (itmax == Hres_wn.end() ? Hres_wn.rows() - 1 : itmax.position()(0));
134 ils_func->ils(wn_center2, Hres_wn(r), response);
144 conv.
value() = response.value() * Hres_rad(r).
value();
146 conv.jacobian() = response.value()(i1) * Hres_rad(r).
jacobian()(i1, i2) +
147 response.jacobian()(Range::all(), 0)(i1) * wn_center.
gradient()(i2) *
148 Hres_rad(r).
value()(i1);
150 conv.jacobian() = response.jacobian()(Range::all(), 0)(i1) *
153 conv.jacobian() = response.value()(i1) * Hres_rad(r).
jacobian()(i1, i2);
154 res(i) = integrate(Hres_wn(r), conv) / normfact;
162 ils_func, ils_half_width_));
167 Os <<
"IlsConvolution:\n";
169 opad << *disp <<
"\n" << *ils_func <<
"\n" 170 <<
"Half Width: " << ils_half_width_ <<
"\n";
bool is_constant() const
Is this object a constant (with a gradient() all zeros)?
This is a filtering stream that adds a pad to the front of every line written out.
virtual void print(std::ostream &Os) const
This is a ILS where we use a Dispersion object to determine the wavenumbers of each pixel...
This is the base of the exception hierarchy for Full Physics code.
#define REGISTER_LUA_DERIVED_CLASS(X, Y)
const blitz::Array< T, D+1 > jacobian() const
Apply value function to a blitz array.
const blitz::Array< T, D > & value() const
const blitz::Array< T, 1 > & gradient() const
Gradient.
We frequently have a double with units associated with it.
int number_variable() const
virtual blitz::Array< double, 1 > apply_ils(const blitz::Array< double, 1 > &High_resolution_wave_number, const blitz::Array< double, 1 > &High_resolution_radiance, const std::vector< int > &Pixel_list) const
Apply the ILS.
This class models an Instrument Line Shape (ILS).
Contains classes to abstract away details in various Spurr Radiative Transfer software.
const T & value() const
Convert to type T.
#define REGISTER_LUA_END()
virtual boost::shared_ptr< Ils > clone() const
Clone an Ils object.