43 for(
auto& v: vars)
if(var == v) var_OK =
true;
47 bool coeff_OK =
false;
48 for(
auto& c: coeffs)
if(coeff == c) coeff_OK =
true;
51 if(not var_OK or not coeff_OK) {
53 os <<
"At least one of your variable and/or your coefficient is not OK\n";
54 os <<
"Your variable: \"" << var <<
"\". OK variables include: " << vars <<
"\n";
55 os <<
"Your coefficient: \"" << coeff <<
"\". OK coefficients include: " << coeffs <<
"\n";
56 throw std::runtime_error(os.str());
60 #define ReturnJacPropMatType(ID) \ 61 (var == #ID) { if(coeff == "X0") return JacPropMatType::LineShape ## ID ## X0; \ 62 else if(coeff == "X1") return JacPropMatType::LineShape ## ID ## X1; \ 63 else if(coeff == "X2") return JacPropMatType::LineShape ## ID ## X2; } 75 #undef ReturnJacPropMatType 84 auto i = self_in_list ? 1 : 0;
90 m.
mdata = std::vector<SingleSpeciesModel>(6+
i);
102 for(
auto& v: m.
mdata) {
103 v.G0().type = TemperatureModel::T1;
104 v.D0().type = TemperatureModel::T5;
115 if(self_in_list) is >> throwaways;
116 for(
auto& v: m.
mdata) is >> v.G0().X0;
119 if(self_in_list) is >> throwaways;
120 for(
auto& v: m.
mdata) {
122 v.D0().X1 = v.G0().X1;
126 for(std::vector<SingleSpeciesModel>::size_type k=
i; k<m.
mdata.size(); k++)
154 m.
mdata.resize(specs);
156 if(not specs and m.
mtype not_eq Type::DP)
157 throw std::runtime_error(
"Need at least one species for non-Doppler line shapes");
164 if(s == self_broadening) {
168 throw std::runtime_error(
"Self broadening must be first, it is not\n");
171 else if(s == bath_broadening) {
174 if(
i not_eq specs - 1)
175 throw std::runtime_error(
"Air/bath broadening must be last, it is not\n");
182 catch(
const std::runtime_error& e) {
184 os <<
"Encountered " << s <<
" in a position where a species should have been ";
185 os <<
"defined.\nPlease check your pressure broadening data structure and ensure ";
186 os <<
"that it follows the correct conventions.\n";
187 os <<
"SpeciesTag error reads: " << e.what();
188 throw std::runtime_error(os.
str());
193 for(
auto& params: {shapeparams, mixingparams}) {
194 for(
auto& param: params) {
218 throw std::runtime_error(
"Unknown number of input parameters in Legacy mode.");
223 throw std::runtime_error(
"Too many input parameters in interpolation results Legacy mode.");
224 for(
Index k=0; k<ntemp; k++)
225 data >> m.
mdata[
i].Interp()[k];
262 Vector x(
n);
for(
auto& num: x) data >> num;
273 case TypePB::PB_NONE:
275 case TypePB::PB_AIR_BROADENING:
276 return Model(x[0], x[1], x[2], x[3], x[4]);
277 case TypePB::PB_AIR_AND_WATER_BROADENING:
280 std::vector<SingleSpeciesModel> ssm(2);
281 ssm[0].G0() = {TemperatureModel::T1, x[0], x[1], 0};
282 ssm[0].D0() = {TemperatureModel::T5, x[2], x[1], 0};
283 ssm[1].G0() = {TemperatureModel::T1, x[3], x[4], 0};
284 ssm[1].D0() = {TemperatureModel::T5, x[5], x[4], 0};
289 std::vector<SingleSpeciesModel> ssm(3);
290 ssm[0].G0() = {TemperatureModel::T1, x[0], x[1], 0};
291 ssm[0].D0() = {TemperatureModel::T5, x[2], x[1], 0};
292 ssm[2].G0() = {TemperatureModel::T1, x[3], x[4], 0};
293 ssm[2].D0() = {TemperatureModel::T5, x[5], x[4], 0};
294 ssm[1].G0() = {TemperatureModel::T1, x[6], x[7], 0};
295 ssm[1].D0() = {TemperatureModel::T5, x[8], x[7], 0};
298 case TypePB::PB_PLANETARY_BROADENING:
306 std::vector<SingleSpeciesModel> ssm(6);
307 ssm[0].G0() = {TemperatureModel::T1, x[1 ], x[8 ], 0};
308 ssm[0].D0() = {TemperatureModel::T5, x[14], x[8 ], 0};
309 ssm[1].G0() = {TemperatureModel::T1, x[2 ], x[9 ], 0};
310 ssm[1].D0() = {TemperatureModel::T5, x[15], x[9 ], 0};
311 ssm[2].G0() = {TemperatureModel::T1, x[3 ], x[10], 0};
312 ssm[2].D0() = {TemperatureModel::T5, x[16], x[10], 0};
313 ssm[3].G0() = {TemperatureModel::T1, x[4 ], x[11], 0};
314 ssm[3].D0() = {TemperatureModel::T5, x[17], x[11], 0};
315 ssm[4].G0() = {TemperatureModel::T1, x[5 ], x[12], 0};
316 ssm[4].D0() = {TemperatureModel::T5, x[18], x[12], 0};
317 ssm[5].G0() = {TemperatureModel::T1, x[6 ], x[13], 0};
318 ssm[5].D0() = {TemperatureModel::T5, x[19], x[13], 0};
329 std::vector<SingleSpeciesModel> ssm(7);
330 ssm[0].G0() = {TemperatureModel::T1, x[0 ], x[7 ], 0};
332 ssm[1].G0() = {TemperatureModel::T1, x[1 ], x[8 ], 0};
333 ssm[1].D0() = {TemperatureModel::T5, x[14], x[8 ], 0};
334 ssm[2].G0() = {TemperatureModel::T1, x[2 ], x[9 ], 0};
335 ssm[2].D0() = {TemperatureModel::T5, x[15], x[9 ], 0};
336 ssm[3].G0() = {TemperatureModel::T1, x[3 ], x[10], 0};
337 ssm[3].D0() = {TemperatureModel::T5, x[16], x[10], 0};
338 ssm[4].G0() = {TemperatureModel::T1, x[4 ], x[11], 0};
339 ssm[4].D0() = {TemperatureModel::T5, x[17], x[11], 0};
340 ssm[5].G0() = {TemperatureModel::T1, x[5 ], x[12], 0};
341 ssm[5].D0() = {TemperatureModel::T5, x[18], x[12], 0};
342 ssm[6].G0() = {TemperatureModel::T1, x[6 ], x[13], 0};
343 ssm[6].D0() = {TemperatureModel::T5, x[19], x[13], 0};
356 case TypeLM::LM_NONE:
358 case TypeLM::LM_LBLRTM:
363 case TypeLM::LM_LBLRTM_O2NonResonant:
365 y.Data()[0].G().X0 = x[0];
367 case TypeLM::LM_2NDORDER:
369 y.Data()[0].Y().X0 = x[0];
370 y.Data()[0].Y().X1 = x[1];
371 y.Data()[0].Y().X2 = x[7];
373 y.Data()[0].G().X0 = x[2];
374 y.Data()[0].G().X1 = x[3];
375 y.Data()[0].G().X2 = x[8];
377 y.Data()[0].DV().X0 = x[4];
378 y.Data()[0].DV().X1 = x[5];
379 y.Data()[0].DV().X2 = x[9];
381 case TypeLM::LM_1STORDER:
383 y.Data()[0].Y().X0 = x[1];
384 y.Data()[0].Y().X1 = x[2];
386 case TypeLM::LM_BYBAND:
395 bool self = spec == self_broadening;
396 bool bath = spec == bath_broadening;
398 mdata.front().Set(var, param);
400 throw std::runtime_error(
"No self species but trying to set self in line shape model");
401 else if(
mbath and bath) {
402 mdata.back().Set(var, param);
405 throw std::runtime_error(
"No bath species but trying to set bath in line shape model");
417 os <<
"No species of type " << spec <<
" found in line shape model\n";
418 os <<
"Available species are: " <<
mspecies <<
"\n";
419 throw std::runtime_error(os.str());
INDEX Index
The type to use for all integer numbers and indices.
void copy(ConstComplexIterator1D origin, const ConstComplexIterator1D &end, ComplexIterator1D target)
Copy data between begin and end to target.
void var(VectorView var, const Vector &y, const ArrayOfVector &ys, const Index start=0, const Index end=-1)
Compute the variance of the ranged ys.
TemperatureModel string2temperaturemodel(const String &type)
Turns predefined strings into a TemperatureModel type.
LegacyLineMixingData::TypeLM string2typelm(String type)
Line mixing types from string.
std::istream & from_linefunctiondata(std::istream &data, Model &lsc)
Index typepb2nelem(LegacyPressureBroadeningData::TypePB type)
Pressure broadening types to number of elements.
std::vector< Variable > linemixingtag2variablesvector(String type)
Line mixing models.
Index temperaturemodel2legacynelem(TemperatureModel type) noexcept
Length per variable.
ArrayOfSpeciesTag mspecies
std::vector< SingleSpeciesModel > mdata
Model vector2modellm(Vector x, LegacyLineMixingData::TypeLM type)
LineShape::Model from legacy input vector.
Index Species() const
Molecular species index.
Main line shape model class.
Index typelm2nelem(LegacyLineMixingData::TypeLM type)
Line mixing types to number.
#define ReturnJacPropMatType(ID)
Model vector2modelpb(Vector x, LegacyPressureBroadeningData::TypePB type, bool self_in_list)
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
void Set(const ModelParameters ¶m, const String &spec, const Variable var)
ArrayOfString all_variablesLineFunctionData()
{"G0", "D0", "G2", "D2", "ETA", "FVC", "Y", "G", "DV"}
Contains the line function data class.
JacPropMatType
List of Jacobian properties for analytical line shape related derivatives.
Iterator1D begin()
Return iterator to first element.
Iterator1D end()
Return iterator behind last element.
bool self_listed(const QuantumIdentifier &qid, LegacyPressureBroadeningData::TypePB t)
Pressure broadening if self exist.
std::istream & from_artscat4(std::istream &is, Model &lsc, const QuantumIdentifier &qid)
_CS_string_type str() const
constexpr Index nmaxTempModelParams
Current max number of coefficients.
constexpr Index nmaxInterpModels
A tag group can consist of the sum of several of these.
Variable
List of possible shape variables.
Coefficients and temperature model for SingleSpeciesModel.
LegacyPressureBroadeningData::TypePB string2typepb(String type)
Pressure broadening types from string.
Class to identify and match lines by their quantum numbers.
NUMERIC Numeric
The type to use for all floating point numbers.
std::istream & from_linemixingdata(std::istream &data, Model &lsc)
Legacy reading of old deprecated LineMixingData class.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
This can be used to make arrays out of anything.
ArrayOfString all_coefficientsLineFunctionData()
{"X0", "X1", "X2"}
std::istream & from_pressurebroadeningdata(std::istream &data, Model &lsc, const QuantumIdentifier &qid)
JacPropMatType select_derivativeLineShape(const String &var, const String &coeff)
Select the derivative that will be used in Jacobian calculations — also checks validity of var and c...
Type string2shapetype(const String &type)
Turns predefined strings into a Type.
my_basic_string< char > String
The String type for ARTS.
std::vector< Variable > lineshapetag2variablesvector(String type)
Line shape models.