ARTS  2.4.0(git:4fb77825)
lineshapemodel.cc
Go to the documentation of this file.
1 /* Copyright (C) 2018
2  Richard Larsson <larsson@mps.mpg.de>
3 
4 
5  This program is free software; you can redistribute it and/or modify it
6  under the terms of the GNU General Public License as published by the
7  Free Software Foundation; either version 2, or (at your option) any
8  later version.
9 
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20  USA. */
21 
35 #include "lineshapemodel.h"
36 
37 ArrayOfString AllLineShapeCoeffs() { return {"X0", "X1", "X2", "X3"}; }
38 
40  return {"G0", "D0", "G2", "D2", "FVC", "ETA", "Y", "G", "DV"};
41 }
42 
44  const String& coeff) {
45  // Test viability of model variables
46  static const ArrayOfString vars = AllLineShapeVars();
47  bool var_OK = false;
48  for (auto& v : vars)
49  if (var == v) var_OK = true;
50 
51  // Test viability of model coefficients
52  static const ArrayOfString coeffs = AllLineShapeCoeffs();
53  bool coeff_OK = false;
54  for (auto& c : coeffs)
55  if (coeff == c) coeff_OK = true;
56 
57  // Fails either when the user has bad input or when the developer fails to update AllLineShapeVars or AllLineShapeCoeffs
58  if (not var_OK or not coeff_OK) {
59  std::ostringstream os;
60  os << "At least one of your variable and/or your coefficient is not OK\n";
61  os << "Your variable: \"" << var << "\". OK variables include: " << vars
62  << "\n";
63  os << "Your coefficient: \"" << coeff
64  << "\". OK coefficients include: " << coeffs << "\n";
65  throw std::runtime_error(os.str());
66  }
67 
68 // Define a repetitive pattern. Update if/when there are more coefficients in the future
69 #define ReturnJacPropMatType(ID) \
70  (var == #ID) { \
71  if (coeff == "X0") \
72  return JacPropMatType::LineShape##ID##X0; \
73  else if (coeff == "X1") \
74  return JacPropMatType::LineShape##ID##X1; \
75  else if (coeff == "X2") \
76  return JacPropMatType::LineShape##ID##X2; \
77  else if (coeff == "X3") \
78  return JacPropMatType::LineShape##ID##X3; \
79  }
80 
82  else if ReturnJacPropMatType(D0)
83  else if ReturnJacPropMatType(G2)
84  else if ReturnJacPropMatType(D2)
85  else if ReturnJacPropMatType(FVC)
86  else if ReturnJacPropMatType(ETA)
87  else if ReturnJacPropMatType(Y)
88  else if ReturnJacPropMatType(G)
89  else if ReturnJacPropMatType(DV)
90 #undef ReturnJacPropMatType
91 
92  std::terminate();
93 }
94 
95 std::istream& LineShape::from_artscat4(std::istream& is,
96  Type& mtype,
97  bool& self,
98  bool& bath,
99  Model& m,
100  ArrayOfSpeciesTag& species,
101  const QuantumIdentifier& qid) {
102  // Set or reset variables
103  mtype = Type::VP;
104  self = true;
105  bath = false;
106  m.mdata = std::vector<SingleSpeciesModel>(7);
107  species = ArrayOfSpeciesTag(7);
108 
109  // Set species
110  species[1] = SpeciesTag("N2");
111  species[2] = SpeciesTag("O2");
112  species[3] = SpeciesTag("H2O");
113  species[4] = SpeciesTag("CO2");
114  species[5] = SpeciesTag("H2");
115  species[6] = SpeciesTag("He");
116 
117  // Temperature types
118  for (auto& v : m.mdata) {
119  v.G0().type = TemperatureModel::T1;
120  v.D0().type = TemperatureModel::T5;
121  }
122 
123  // G0 main coefficient
124  for (auto& v : m.mdata) is >> v.G0().X0;
125 
126  // G0 exponent is same as D0 exponent
127  for (auto& v : m.mdata) {
128  is >> v.G0().X1;
129  v.D0().X1 = v.G0().X1;
130  }
131 
132  // D0 coefficient
133  m.mdata.front().D0().X0 = 0;
134  for (int k = 1; k < 7; k++)
135  is >> m.mdata[k].D0().X0;
136 
137  // Special case when self is part of this list, it needs to be removed
138  for (int k = 1; k < 7; k++) {
139  if (qid.Species() == species[k].Species()) {
140  if(m.mdata.front().G0().X0 not_eq m.mdata[k].G0().X0 or
141  m.mdata.front().G0().X1 not_eq m.mdata[k].G0().X1 or
142  m.mdata.front().D0().X1 not_eq m.mdata[k].D0().X1) {
143  std::ostringstream os;
144  os << "Species is " << qid.SpeciesName() << " and this is a broadening species in ARTSCAT-4.\n"
145  << "Despite this, values representing self and " << qid.SpeciesName() << " does not match "
146  << "in input string\n";
147  throw std::runtime_error(os.str());
148  }
149  m.mdata.front().D0().X0 = m.mdata[k].D0().X0;
150  m.Remove(k, species);
151  break;
152  }
153  }
154 
155  return is;
156 }
157 
158 std::istream& LineShape::from_linefunctiondata(std::istream& data,
159  Type& mtype,
160  bool& self,
161  bool& bath,
162  Model& m,
163  ArrayOfSpeciesTag& species) {
164  self = bath = false;
165  Index specs;
166  String s;
167 
168  // The first tag should give the line shape scheme
169  data >> s;
170  mtype = LineShape::string2shapetype(s);
171 
172  // Order of elements for line shape
173  const auto shapeparams =
175 
176  // The second tag should give the line mixing scheme
177  data >> s;
178 
179  // Order of elements for line mixing
180  const auto mixingparams =
182 
183  // The third tag should contain the number of species
184  data >> specs;
185  species.resize(specs);
186  m.mdata.resize(specs);
187 
188  if (not specs and mtype not_eq Type::DP)
189  throw std::runtime_error(
190  "Need at least one species for non-Doppler line shapes");
191 
192  // For all species, we need to set the methods to compute them
193  for (Index i = 0; i < specs; i++) {
194  // This should be a species tag or one of the specials, SELF or BATH
195  data >> s;
196  if (s == self_broadening) {
197  // If the species is self, then we need to flag this
198  self = true;
199  if (i not_eq 0) // but self has to be first for consistent behavior
200  throw std::runtime_error("Self broadening must be first, it is not\n");
201  }
202 
203  else if (s == bath_broadening) {
204  // If the species is air, then we need to flag this
205  bath = true;
206  if (i not_eq
207  specs - 1) // but air has to be last because it needs the rest's VMR
208  throw std::runtime_error(
209  "Air/bath broadening must be last, it is not\n");
210  } else {
211  // Otherwise, we hope we find a species
212  try {
213  species[i] = SpeciesTag(s);
214  } catch (const std::runtime_error& e) {
215  ostringstream os;
216  os << "Encountered " << s
217  << " in a position where a species should have been ";
218  os << "defined.\nPlease check your pressure broadening data structure and ensure ";
219  os << "that it follows the correct conventions.\n";
220  os << "SpeciesTag error reads: " << e.what();
221  throw std::runtime_error(os.str());
222  }
223  }
224 
225  // For all parameters
226  for (auto& params : {shapeparams, mixingparams}) {
227  for (auto& param : params) {
228  data >> s; // Should contain a temperature tag
229 
230  const auto type = string2temperaturemodel(s);
231  const Index ntemp =
233 
234  m.mdata[i].Data()[Index(param)].type = type;
235  if (ntemp <= nmaxTempModelParams) {
236  switch (ntemp) {
237  case 1:
238  data >> m.mdata[i].Data()[Index(param)].X0;
239  break;
240  case 2:
241  data >> m.mdata[i].Data()[Index(param)].X0 >>
242  m.mdata[i].Data()[Index(param)].X1;
243  break;
244  case 3:
245  data >> m.mdata[i].Data()[Index(param)].X0 >>
246  m.mdata[i].Data()[Index(param)].X1 >>
247  m.mdata[i].Data()[Index(param)].X2;
248  break;
249  case 0:
250  break;
251  default:
252  throw std::runtime_error(
253  "Unknown number of input parameters in Legacy mode.");
254  }
255  } else { // Has to be the only allowed interpolation case
256  if (ntemp > 12) {
257  throw std::runtime_error(
258  "Too many input parameters in interpolation results Legacy mode.");
259  }
260  Numeric temp;
261  data >> temp; // should be 200
262  data >> temp; // should be 250
263  data >> temp; // should be 296
264  data >> temp; // should be 340
265  data >> m.mdata[i].Y().X0 >> m.mdata[i].Y().X1 >> m.mdata[i].Y().X2 >> m.mdata[i].Y().X3
266  >> m.mdata[i].G().X0 >> m.mdata[i].G().X1 >> m.mdata[i].G().X2 >> m.mdata[i].G().X3;
267  }
268  }
269  }
270  }
271 
272  return data;
273 }
274 
276  std::istream& data,
277  LineShape::Type& mtype,
278  bool& self,
279  bool& bath,
280  Model& m,
281  ArrayOfSpeciesTag& species,
282  const QuantumIdentifier& qid) {
283  String s;
284  data >> s;
285 
286  const auto type = LegacyPressureBroadeningData::string2typepb(s);
287  const auto n = LegacyPressureBroadeningData::typepb2nelem(type);
288  const auto self_in_list =
290 
291  Vector x(n);
292  for (auto& num : x) data >> num;
293 
295  self,
296  bath,
297  m,
298  species,
299  x,
300  type,
301  self_in_list);
302 
303  return data;
304 }
305 
306 std::istream& LineShape::from_linemixingdata(std::istream& data,
307  LineShape::Model& lsc) {
308  String s;
309  data >> s;
310 
311  const auto type = LegacyLineMixingData::string2typelm(s);
312  const auto n = LegacyLineMixingData::typelm2nelem(type);
313 
314  Vector x(n);
315  for (auto& num : x) data >> num;
316 
318 
319  return data;
320 }
321 
323  LineShape::Type& mtype,
324  bool& self,
325  bool& bath,
326  Model& m,
327  ArrayOfSpeciesTag& species,
328  Vector x,
330  bool self_in_list) {
331  switch (type) {
332  case TypePB::PB_NONE:
333  mtype = LineShape::Type::DP;
334  self = bath = false;
335  m = Model();
336  species.resize(0);
337  return;
338  case TypePB::PB_AIR_BROADENING:
339  mtype = LineShape::Type::VP;
340  self = bath = true;
341  m = Model(x[0], x[1], x[2], x[3], x[4]);
342  species.resize(2);
343  return;
344  case TypePB::PB_AIR_AND_WATER_BROADENING:
345  if (self_in_list) {
346  mtype = LineShape::Type::VP;
347  self = false;
348  bath = true;
349  m.Data().resize(2);
350  m.Data()[0].G0() = {TemperatureModel::T1, x[0], x[1], 0, 0};
351  m.Data()[0].D0() = {TemperatureModel::T5, x[2], x[1], 0, 0};
352  m.Data()[1].G0() = {TemperatureModel::T1, x[3], x[4], 0, 0};
353  m.Data()[1].D0() = {TemperatureModel::T5, x[5], x[4], 0, 0};
354  species.resize(2);
355  species[0] = SpeciesTag("H2O");
356  return;
357  } else {
358  mtype = LineShape::Type::VP;
359  self = bath = true;
360  m.Data().resize(2);
361  m.Data()[0].G0() = {TemperatureModel::T1, x[0], x[1], 0, 0};
362  m.Data()[0].D0() = {TemperatureModel::T5, x[2], x[1], 0, 0};
363  m.Data()[2].G0() = {TemperatureModel::T1, x[3], x[4], 0, 0};
364  m.Data()[2].D0() = {TemperatureModel::T5, x[5], x[4], 0, 0};
365  m.Data()[1].G0() = {TemperatureModel::T1, x[6], x[7], 0, 0};
366  m.Data()[1].D0() = {TemperatureModel::T5, x[8], x[7], 0, 0};
367  species.resize(3);
368  species[1] = SpeciesTag("H2O");
369  return;
370  }
371  case TypePB::PB_PLANETARY_BROADENING:
372  if (self_in_list) {
373  mtype = LineShape::Type::VP;
374  self = bath = false;
375  m.Data().resize(6);
376  m.Data()[0].G0() = {TemperatureModel::T1, x[1], x[8], 0, 0};
377  m.Data()[0].D0() = {TemperatureModel::T5, x[14], x[8], 0, 0};
378  m.Data()[1].G0() = {TemperatureModel::T1, x[2], x[9], 0, 0};
379  m.Data()[1].D0() = {TemperatureModel::T5, x[15], x[9], 0, 0};
380  m.Data()[2].G0() = {TemperatureModel::T1, x[3], x[10], 0, 0};
381  m.Data()[2].D0() = {TemperatureModel::T5, x[16], x[10], 0, 0};
382  m.Data()[3].G0() = {TemperatureModel::T1, x[4], x[11], 0, 0};
383  m.Data()[3].D0() = {TemperatureModel::T5, x[17], x[11], 0, 0};
384  m.Data()[4].G0() = {TemperatureModel::T1, x[5], x[12], 0, 0};
385  m.Data()[4].D0() = {TemperatureModel::T5, x[18], x[12], 0, 0};
386  m.Data()[5].G0() = {TemperatureModel::T1, x[6], x[13], 0, 0};
387  m.Data()[5].D0() = {TemperatureModel::T5, x[19], x[13], 0, 0};
388  species = {SpeciesTag(String("N2")),
389  SpeciesTag(String("O2")),
390  SpeciesTag(String("H2O")),
391  SpeciesTag(String("CO2")),
392  SpeciesTag(String("H2")),
393  SpeciesTag(String("He"))};
394  return;
395  } else {
396  mtype = LineShape::Type::VP;
397  self = true;
398  bath = false;
399  m.Data().resize(7);
400  m.Data()[0].G0() = {TemperatureModel::T1, x[0], x[7], 0, 0};
401  // ssm[0].D0() = ...
402  m.Data()[1].G0() = {TemperatureModel::T1, x[1], x[8], 0, 0};
403  m.Data()[1].D0() = {TemperatureModel::T5, x[14], x[8], 0, 0};
404  m.Data()[2].G0() = {TemperatureModel::T1, x[2], x[9], 0, 0};
405  m.Data()[2].D0() = {TemperatureModel::T5, x[15], x[9], 0, 0};
406  m.Data()[3].G0() = {TemperatureModel::T1, x[3], x[10], 0, 0};
407  m.Data()[3].D0() = {TemperatureModel::T5, x[16], x[10], 0, 0};
408  m.Data()[4].G0() = {TemperatureModel::T1, x[4], x[11], 0, 0};
409  m.Data()[4].D0() = {TemperatureModel::T5, x[17], x[11], 0, 0};
410  m.Data()[5].G0() = {TemperatureModel::T1, x[5], x[12], 0, 0};
411  m.Data()[5].D0() = {TemperatureModel::T5, x[18], x[12], 0, 0};
412  m.Data()[6].G0() = {TemperatureModel::T1, x[6], x[13], 0, 0};
413  m.Data()[6].D0() = {TemperatureModel::T5, x[19], x[13], 0, 0};
414  species.resize(7);
415  species[1] = SpeciesTag(String("N2"));
416  species[2] = SpeciesTag(String("O2"));
417  species[3] = SpeciesTag(String("H2O"));
418  species[4] = SpeciesTag(String("CO2"));
419  species[5] = SpeciesTag(String("H2"));
420  species[6] = SpeciesTag(String("He"));
421  return;
422  }
423  }
424  std::terminate();
425 }
426 
429  Model y(1);
430  switch (type) {
431  case TypeLM::LM_NONE:
432  break;
433  case TypeLM::LM_LBLRTM:
434  y.Data().front().Y().type = LineShape::TemperatureModel::LM_AER;
435  y.Data().front().G().type = LineShape::TemperatureModel::LM_AER;
436  y.Data().front().Y().X0 = x[4];
437  y.Data().front().Y().X1 = x[5];
438  y.Data().front().Y().X2 = x[6];
439  y.Data().front().Y().X3 = x[7];
440  y.Data().front().G().X0 = x[8];
441  y.Data().front().G().X1 = x[9];
442  y.Data().front().G().X2 = x[10];
443  y.Data().front().G().X3 = x[11];
444  break;
445  case TypeLM::LM_LBLRTM_O2NonResonant:
446  y.Data().front().G().type = LineShape::TemperatureModel::T0;
447  y.Data().front().G().X0 = x[0];
448  break;
449  case TypeLM::LM_2NDORDER:
450  y.Data().front().Y().type = LineShape::TemperatureModel::T4;
451  y.Data().front().Y().X0 = x[0];
452  y.Data().front().Y().X1 = x[1];
453  y.Data().front().Y().X2 = x[7];
454  y.Data().front().G().type = LineShape::TemperatureModel::T4;
455  y.Data().front().G().X0 = x[2];
456  y.Data().front().G().X1 = x[3];
457  y.Data().front().G().X2 = x[8];
458  y.Data().front().DV().type = LineShape::TemperatureModel::T4;
459  y.Data().front().DV().X0 = x[4];
460  y.Data().front().DV().X1 = x[5];
461  y.Data().front().DV().X2 = x[9];
462  break;
463  case TypeLM::LM_1STORDER:
464  y.Data().front().Y().type = LineShape::TemperatureModel::T1;
465  y.Data().front().Y().X0 = x[1];
466  y.Data().front().Y().X1 = x[2];
467  break;
468  case TypeLM::LM_BYBAND:
469  break;
470  }
471  return y;
472 }
473 
474 Vector LineShape::vmrs(const ConstVectorView& atmospheric_vmrs,
475  const ArrayOfArrayOfSpeciesTag& atmospheric_species,
476  const QuantumIdentifier& self,
477  const ArrayOfSpeciesTag& lineshape_species,
478  bool self_in_list,
479  bool bath_in_list,
480  Type type) {
481  if (atmospheric_species.nelem() != atmospheric_vmrs.nelem())
482  throw std::runtime_error("Bad atmospheric inputs");
483 
484  // Initialize list of VMRS to 0
485  Vector line_vmrs(lineshape_species.nelem(), 0);
486  const Index back = lineshape_species.nelem() - 1; // Last index
487 
488  if (type == Type::DP) return line_vmrs;
489 
490  // Loop species ignoring self and bath
491  for (Index i = 0; i < lineshape_species.nelem()-bath_in_list; i++) {
492  // Select target in-case this is self-broadening
493  const auto target =
494  (self_in_list and &lineshape_species[i] == &lineshape_species.front()) ? self.Species() : lineshape_species[i].Species();
495 
496  // Find species in list or do nothing at all
497  Index this_species_index = -1;
498  for (Index j = 0; j < atmospheric_species.nelem(); j++)
499  if (atmospheric_species[j][0].Species() == target)
500  this_species_index = j;
501 
502  // Set to non-zero in-case species exists
503  if (this_species_index not_eq -1)
504  line_vmrs[i] = atmospheric_vmrs[this_species_index];
505  }
506 
507  // Renormalize, if bath-species exist this is automatic.
508  if (bath_in_list)
509  line_vmrs[back] = 1.0 - line_vmrs.sum();
510  else if(line_vmrs.sum() == 0) // Special case, there should be no atmosphere if this happens???
511  return line_vmrs;
512  else
513  line_vmrs /= line_vmrs.sum();
514 
515  // The result must be non-zero, a real number, and finite
516  if (not std::isnormal(line_vmrs.sum()))
517  throw std::runtime_error(
518  "Bad VMRs, your atmosphere does not support the line of interest");
519 
520  return line_vmrs;
521 }
522 
523 std::ostream& LineShape::operator<<(std::ostream& os, const LineShape::Model& m)
524 {
525  for(auto& data: m.Data())
526  os << data;
527  return os;
528 }
529 
530 std::istream& LineShape::operator>>(std::istream& is, Model& m)
531 {
532  for(auto& data: m.Data())
533  is >> data;
534  return is;
535 }
536 
537 
539 {
540  String out = "";
541 
542  const auto names = AllLineShapeVars();
543  std::vector<Variable> vars(0);
544  for (auto& n: names)
545  vars.push_back(string2variable(n));
546 
547  for (auto& var: vars) {
548  if (std::any_of(m.Data().cbegin(), m.Data().cend(),
549  [var](auto& x){return x.Get(var).type not_eq TemperatureModel::None;})) {
550  out += variable2string(var) + ' ';
551  for (auto& ssm: m.Data())
552  out += temperaturemodel2string(ssm.Get(var).type) + ' ';
553  }
554  }
555 
556  if(out.size())
557  out.pop_back();
558 
559  return out;
560 }
561 
562 
564 {
565  if (s.nelem() == 0)
566  return LineShape::Model();
567 
568  const auto names = AllLineShapeVars();
569 
570  std::istringstream str(s);
571  String part;
572  Variable var=Variable::ETA;
573  TemperatureModel tm=TemperatureModel::None;
574  Index i=-100000;
575 
576  std::vector<SingleSpeciesModel> ssms(0);
577  while (not str.eof()) {
578  str >> part;
579  if(std::any_of(names.cbegin(), names.cend(),
580  [part](auto x){return part == x;})) {
581  i=-1;
582  var = string2variable(part);
583  }
584  else {
585  i++;
586  tm = string2temperaturemodel(part);
587  }
588 
589  if (i < 0)
590  continue;
591  else if (i < Index(ssms.size()))
592  goto add_var;
593  else {
594  ssms.push_back(SingleSpeciesModel());
595  add_var:
596  auto mp = ssms[i].Get(var);
597  mp.type = tm;
598  ssms[i].Set(var, mp);
599  }
600  }
601 
602  return Model(std::move(ssms));
603 }
604 
606 {
607  std::ostringstream os;
608  switch (mp.type) {
609  case TemperatureModel::None:
610  os << 0;
611  break;
612  case TemperatureModel::T0:
613  os << mp.X0;
614  break;
615  case TemperatureModel::T1:
616  os << mp.X0 << " * (" << T0 << "/T)^" << mp.X1;
617  break;
618  case TemperatureModel::T2:
619  os << mp.X0 << " * (" << T0 << "/T)^" << mp.X1 << " / (1 + " << mp.X2 << " * log(T/" << T0 << "))";
620  break;
621  case TemperatureModel::T3:
622  os << mp.X0 << " + " << mp.X1 << " * (" << T0 << " - T)";
623  break;
624  case TemperatureModel::T4:
625  os << "(" << mp.X0 << " + " << mp.X1 << " * (" << T0 << "/T - 1)) * (" << T0 << "/T)^" << mp.X2;
626  break;
627  case TemperatureModel::T5:
628  os << mp.X0 << " * (" << T0 << "/T)^(0.25 + 1.5 * " << mp.X1 << ")";
629  break;
630  case TemperatureModel::LM_AER:
631  os << '(' << "Linear interpolation to y(x) from x-ref = [200, 250, 296, 340] and y-ref = [" << mp.X0 << ", " << mp.X1 << ", " << mp.X2 << ", " << mp.X3 << ']' << ')';
632  break;
633  case TemperatureModel::DPL:
634  os << '(' << mp.X0 << " * (" << T0 << "/T)^" << mp.X1 << " + " << mp.X2 << " * (" << T0 << "/T)^" << mp.X3 << ')';
635  break;
636  }
637 
638  return os.str();
639 }
640 
642  const bool self,
643  const bool bath,
644  const ArrayOfSpeciesTag& sts,
645  const Numeric T0)
646 {
647  const auto names = AllLineShapeVars();
648  std::vector<Variable> vars(0);
649  for (auto& n: names)
650  vars.push_back(string2variable(n));
651 
652  ArrayOfString as(0);
653 
654  for (Index i=0; i<names.nelem(); i++) {
655  Variable var = vars[i];
656 
657  if (std::any_of(m.Data().cbegin(), m.Data().cend(),
658  [var](auto& x){return x.Get(var).type not_eq TemperatureModel::None;})) {
659 
660  std::ostringstream os;
661  os << names[i] << " ~ ";
662  for (Index j=0; j<sts.nelem(); j++) {
663  if (&sts[j] == &sts.front() and self)
664  os << "VMR(" << self_broadening << ") * "
665  << modelparameters2metadata(m.Data().front().Get(var), T0);
666  else if (&sts[j] == &sts.back() and bath)
667  os << "VMR(" << bath_broadening << ") * "
668  << modelparameters2metadata(m.Data().back().Get(var), T0);
669  else
670  os << "VMR(" << sts[j].SpeciesNameMain() << ") * "
671  << modelparameters2metadata(m.Data()[j].Get(var), T0);
672 
673  if (&sts[j] not_eq &sts.back())
674  os << " + ";
675  }
676  as.push_back(os.str());
677  }
678  }
679 
680  return as;
681 }
LineShape::operator>>
std::istream & operator>>(std::istream &is, ModelParameters &mp)
Input operator for ModelParameters.
Definition: lineshapemodel.h:345
LineShape::from_linefunctiondata
std::istream & from_linefunctiondata(std::istream &data, Type &type, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species)
Definition: lineshapemodel.cc:158
AllLineShapeCoeffs
ArrayOfString AllLineShapeCoeffs()
All available line shape coefficients.
Definition: lineshapemodel.cc:37
LineShape::LegacyLineFunctionData::temperaturemodel2legacynelem
Index temperaturemodel2legacynelem(TemperatureModel type) noexcept
Length per variable for temperature model.
Definition: lineshapemodel.h:1455
LineShape::TemperatureModel::T0
@ T0
QuantumIdentifier
Class to identify and match lines by their quantum numbers.
Definition: quantum.h:390
AllLineShapeVars
ArrayOfString AllLineShapeVars()
All available line shape variables.
Definition: lineshapemodel.cc:39
LineShape::variable2string
String variable2string(Variable type) noexcept
Turns selected Variable type into a string.
Definition: lineshapemodel.h:218
LineShape::ModelShape2MetaData
String ModelShape2MetaData(const Model &m)
Definition: lineshapemodel.cc:538
LineShape::TemperatureModel
TemperatureModel
Temperature models.
Definition: lineshapemodel.h:76
temp
#define temp
Definition: legacy_continua.cc:20951
LineShape::ModelParameters::X1
Numeric X1
Definition: lineshapemodel.h:273
LineShape::ModelParameters::type
TemperatureModel type
Definition: lineshapemodel.h:271
LineShape::string2variable
Variable string2variable(const String &type)
Turns predefined strings into a Variable type.
Definition: lineshapemodel.h:246
ARTS::Var::y
Vector y(Workspace &ws) noexcept
Definition: autoarts.h:7401
LineShape::MetaData2ModelShape
Model MetaData2ModelShape(const String &s)
Definition: lineshapemodel.cc:563
LineShape::operator<<
std::ostream & operator<<(std::ostream &os, Variable v)
Output operator for Variable to be human-readable.
Definition: lineshapemodel.h:176
LineShape::TemperatureModel::T4
@ T4
ArrayOfSpeciesTag
Array< SpeciesTag > ArrayOfSpeciesTag
A tag group is an array of SpeciesTags.
Definition: abs_species_tags.h:247
data
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
Definition: arts_api_classes.cc:232
Species
QuantumIdentifier::QType Index LowerQuantumNumbers Species
Definition: arts_api_classes.cc:255
JacPropMatType
JacPropMatType
List of Jacobian properties for analytical line shape related derivatives.
Definition: jacobian.h:46
LineShape::from_artscat4
std::istream & from_artscat4(std::istream &is, Type &type, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species, const QuantumIdentifier &qid)
Definition: lineshapemodel.cc:95
LineShape::modelparameters2metadata
String modelparameters2metadata(const ModelParameters mp, const Numeric T0)
Definition: lineshapemodel.cc:605
LineShape::LegacyLineMixingData::typelm2nelem
Index typelm2nelem(LegacyLineMixingData::TypeLM type)
Line mixing types to number.
Definition: lineshapemodel.h:1560
Array< String >
SpeciesTag
A tag group can consist of the sum of several of these.
Definition: abs_species_tags.h:44
select_derivativeLineShape
JacPropMatType select_derivativeLineShape(const String &var, const String &coeff)
Return the derivative type based on string input.
Definition: lineshapemodel.cc:43
LineShape::Model
Main line shape model class.
Definition: lineshapemodel.h:972
QuantumIdentifier::SpeciesName
String SpeciesName() const
Return the Species by name.
Definition: quantum.cc:225
LineShape::SingleSpeciesModel
Compute the line shape parameters for a single broadening species.
Definition: lineshapemodel.h:359
QuantumIdentifier::Species
void Species(Index sp)
Set the Species.
Definition: quantum.h:481
my_basic_string< char >
ConstVectorView::nelem
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:51
LineShape::ModelParameters
Coefficients and temperature model for SingleSpeciesModel.
Definition: lineshapemodel.h:270
LineShape::LegacyPressureBroadeningData::TypePB
TypePB
Pressure broadening types that used to exist.
Definition: lineshapemodel.h:1585
ConstVectorView::sum
Numeric sum() const
The sum of all elements of a Vector.
Definition: matpackI.cc:53
LineShape::nmaxTempModelParams
constexpr Index nmaxTempModelParams
Current max number of coefficients.
Definition: lineshapemodel.h:353
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
linalg::var
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.
Definition: raw.cc:49
LineShape::Variable
Variable
List of possible shape variables.
Definition: lineshapemodel.h:162
LineShape::from_pressurebroadeningdata
std::istream & from_pressurebroadeningdata(std::istream &data, LineShape::Type &type, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species, const QuantumIdentifier &qid)
Legacy reading of old deprecated PressureBroadeningData class.
Definition: lineshapemodel.cc:275
LineShape::from_linemixingdata
std::istream & from_linemixingdata(std::istream &data, Model &lsc)
Legacy reading of old deprecated LineMixingData class.
Definition: lineshapemodel.cc:306
ARTS::Var::Vector::type
Group::Vector type
Definition: autoarts.h:1667
LineShape::Type
Type
Type of line shape to compute.
Definition: lineshapemodel.h:788
my_basic_string::nelem
Index nelem() const
Number of elements.
Definition: mystring.h:246
LineShape::LegacyPressureBroadeningData::self_listed
Index self_listed(const QuantumIdentifier &qid, LegacyPressureBroadeningData::TypePB t)
Pressure broadening if self exist.
Definition: lineshapemodel.h:1616
LineShape::ModelMetaDataArray
ArrayOfString ModelMetaDataArray(const Model &m, const bool self, const bool bath, const ArrayOfSpeciesTag &sts, const Numeric T0)
Definition: lineshapemodel.cc:641
LineShape::Model::mdata
std::vector< SingleSpeciesModel > mdata
Definition: lineshapemodel.h:974
LineShape::LegacyPressureBroadeningData::vector2modelpb
void vector2modelpb(LineShape::Type &mtype, bool &self, bool &bath, Model &m, ArrayOfSpeciesTag &species, Vector x, LegacyPressureBroadeningData::TypePB type, bool self_in_list)
LineShape::Model from legacy input vector.
Definition: lineshapemodel.cc:322
ReturnJacPropMatType
#define ReturnJacPropMatType(ID)
LineShape::LegacyLineFunctionData::lineshapetag2variablesvector
std::vector< Variable > lineshapetag2variablesvector(String type)
Line shape models from string.
Definition: lineshapemodel.h:1480
LineShape::Model::Data
const std::vector< SingleSpeciesModel > & Data() const noexcept
The line shape model data.
Definition: lineshapemodel.h:1345
LineShape::temperaturemodel2string
String temperaturemodel2string(TemperatureModel type) noexcept
Turns selected TemperatureModel type into a string.
Definition: lineshapemodel.h:98
String
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:280
LineShape::LegacyPressureBroadeningData::typepb2nelem
Index typepb2nelem(LegacyPressureBroadeningData::TypePB type)
Pressure broadening types to number of elements.
Definition: lineshapemodel.h:1634
LineShape::TemperatureModel::T1
@ T1
ARTS::Var::x
Vector x(Workspace &ws) noexcept
Definition: autoarts.h:7346
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
LineShape::string2temperaturemodel
TemperatureModel string2temperaturemodel(const String &type)
Turns predefined strings into a TemperatureModel type.
Definition: lineshapemodel.h:131
LineShape::LegacyLineMixingData::vector2modellm
Model vector2modellm(Vector x, LegacyLineMixingData::TypeLM type)
LineShape::Model from legacy input vector.
Definition: lineshapemodel.cc:427
LineShape::LegacyPressureBroadeningData::string2typepb
LegacyPressureBroadeningData::TypePB string2typepb(String type)
Pressure broadening types from string.
Definition: lineshapemodel.h:1598
LineShape::string2shapetype
Type string2shapetype(const String &type)
Turns predefined strings into a Type.
Definition: lineshapemodel.h:855
Vector
The Vector class.
Definition: matpackI.h:860
LineShape::ModelParameters::X0
Numeric X0
Definition: lineshapemodel.h:272
LineShape::LegacyLineFunctionData::linemixingtag2variablesvector
std::vector< Variable > linemixingtag2variablesvector(String type)
Line mixing models from string.
Definition: lineshapemodel.h:1505
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:476
LineShape::ModelParameters::X3
Numeric X3
Definition: lineshapemodel.h:275
Array::nelem
Index nelem() const
Number of elements.
Definition: array.h:195
LineShape::ModelParameters::X2
Numeric X2
Definition: lineshapemodel.h:274
LineShape::LegacyLineMixingData::string2typelm
LegacyLineMixingData::TypeLM string2typelm(String type)
Line mixing types from string.
Definition: lineshapemodel.h:1538
LineShape::Model::Remove
void Remove(Index i, ArrayOfSpeciesTag &specs)
Remove species and data at position.
Definition: lineshapemodel.h:1357
LineShape::LegacyLineMixingData::TypeLM
TypeLM
Line mixing types that used to exist.
Definition: lineshapemodel.h:1528
lineshapemodel.h
Contains the line shape namespace.
LineShape::vmrs
Vector vmrs(const ConstVectorView &atmospheric_vmrs, const ArrayOfArrayOfSpeciesTag &atmospheric_species, const QuantumIdentifier &self, const ArrayOfSpeciesTag &lineshape_species, bool self_in_list, bool bath_in_list, Type type)
Returns a VMR vector for this model's main calculations.
Definition: lineshapemodel.cc:474