ARTS 2.5.0 (git: 9ee3ac6c)
jacobian.h
Go to the documentation of this file.
1/* Copyright (C) 2004-2012 Mattias Ekstrom <ekstrom@rss.chalmers.se>
2
3 This program is free software; you can redistribute it and/or modify it
4 under the terms of the GNU General Public License as published by the
5 Free Software Foundation; either version 2, or (at your option) any
6 later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 USA. */
17
26#ifndef jacobian_h
27#define jacobian_h
28
29#include "species_tags.h"
30#include "agenda_class.h"
31#include "array.h"
32#include "bifstream.h"
33#include "enums.h"
34#include "interpolation.h"
35#include "logic.h"
36#include "matpackI.h"
37#include "methods.h"
38#include "mystring.h"
39#include "ppath.h"
40#include "quantum.h"
41#include <iostream>
42#include <map>
43#include <stdexcept>
44
45namespace Jacobian {
46
49 Atm,
50 Line,
51 Sensor,
52 Special
53 )
54
55
56ENUMCLASS(Atm, char,
61 Particulates
62 )
63
65ENUMCLASS(Line, char,
66 VMR,
67 Strength,
68 Center,
69 ShapeG0X0, ShapeG0X1, ShapeG0X2, ShapeG0X3,
70 ShapeD0X0, ShapeD0X1, ShapeD0X2, ShapeD0X3,
71 ShapeG2X0, ShapeG2X1, ShapeG2X2, ShapeG2X3,
72 ShapeD2X0, ShapeD2X1, ShapeD2X2, ShapeD2X3,
73 ShapeFVCX0, ShapeFVCX1, ShapeFVCX2, ShapeFVCX3,
74 ShapeETAX0, ShapeETAX1, ShapeETAX2, ShapeETAX3,
75 ShapeYX0, ShapeYX1, ShapeYX2, ShapeYX3,
76 ShapeGX0, ShapeGX1, ShapeGX2, ShapeGX3,
77 ShapeDVX0, ShapeDVX1, ShapeDVX2, ShapeDVX3,
78 NLTE,
79 ECS_A, ECS_B, ECS_GAMMA, ECS_DC
80 )
81
83ENUMCLASS(Sensor, char,
89 PointingZenithRecalc
90 )
91
93ENUMCLASS(Special, char,
94 ArrayOfSpeciesTagVMR,
95 ScatteringString,
96 SurfaceString
97 )
98
100class Target {
101private:
103 Type mtype{Type::FINAL};
104
106 Atm matm{Atm::FINAL};
107
109 Line mline{Line::FINAL};
110
112 Sensor msensor{Sensor::FINAL};
113
115 Special mspecial{Special::FINAL};
116
118 Numeric mperturbation{std::numeric_limits<Numeric>::quiet_NaN()};
119
121 QuantumIdentifier mqid{};
122
124 ArrayOfSpeciesTag maostid{0};
125
127 String msid{};
128
130 Species::Species mspecid{Species::Species::FINAL};
131public:
133 explicit Target (Atm type) :
134 mtype(Type::Atm), matm(type) {
136 }
137
139 explicit Target (Line type, const QuantumIdentifier& qid, Species::Species specid) :
140 mtype(Type::Line), mline(type), mqid(qid), mspecid(specid) {
142 }
143
145 explicit Target (Sensor type) :
146 mtype(Type::Sensor), msensor(type) {
148 }
149
151 explicit Target (Special type, const ArrayOfSpeciesTag& aostid) :
152 mtype(Type::Special), mspecial(type), maostid(aostid) {
153 ARTS_ASSERT (type == Special::ArrayOfSpeciesTagVMR,
154 "Only for Special::ArrayOfSpeciesTagVMR, but you fed: ", mspecial)
155 }
156
158 explicit Target (Special type, const String& sid) :
159 mtype(Type::Special), mspecial(type), msid(sid) {
160 ARTS_ASSERT (type == Special::SurfaceString or type == Special::ScatteringString,
161 "Only for Special::ScatteringString or Special::SurfaceString, but you fed: ", mspecial)
162 }
163
165 explicit Target () = default;
166
168 void Perturbation(Numeric x) noexcept {mperturbation=x;}
169 Numeric& Perturbation() noexcept {return mperturbation;}
170 [[nodiscard]] Numeric Perturbation() const noexcept {return mperturbation;}
171
173 void QuantumIdentity(const QuantumIdentifier& x) noexcept {mqid=x;}
174 QuantumIdentifier& QuantumIdentity() noexcept {return mqid;}
175 [[nodiscard]] const QuantumIdentifier& QuantumIdentity() const noexcept {return mqid;}
176
178 void SpeciesList(const ArrayOfSpeciesTag& x) noexcept {maostid = x;}
179 ArrayOfSpeciesTag& SpeciesList() noexcept {return maostid;}
180 [[nodiscard]] const ArrayOfSpeciesTag& SpeciesList() const noexcept {return maostid;}
181
183 void StringKey(const String& x) noexcept {msid = x;}
184 String& StringKey() noexcept {return msid;}
185 const String& StringKey() const noexcept {return msid;}
186
188 [[nodiscard]] Atm AtmType() const noexcept {return matm;}
189
191 [[nodiscard]] Line LineType() const noexcept {return mline;}
192
194 [[nodiscard]] Sensor SensorType() const noexcept {return msensor;}
195
197 [[nodiscard]] Special SpecialType() const noexcept {return mspecial;}
198
200 bool operator==(Atm other) const noexcept {return other == matm;}
201
203 bool operator==(Line other) const noexcept {return other == mline;}
204
206 bool operator==(Sensor other) const noexcept {return other == msensor;}
207
209 bool operator==(Special other) const noexcept {return other == mspecial;}
210
212 bool operator==(Type other) const noexcept {return other == mtype;}
213
214 [[nodiscard]] bool sameTargetType(const Target& other) const noexcept {
215 return mtype == other.mtype and
216 matm == other.matm and
217 mline == other.mline and
218 msensor == other.msensor and
219 mspecial == other.mspecial;
220 }
221
223 std::string_view TargetType() const noexcept {return toString(mtype);}
224
226 void TargetType(const std::string_view& s) noexcept {mtype = toType(s);}
227
229 void TargetSubType(const std::string_view& s) noexcept {
230 matm = Atm::FINAL;
231 mline = Line::FINAL;
232 msensor = Sensor::FINAL;
233 mspecial = Special::FINAL;
234
235 switch (mtype) {
236 case Type::Atm: matm = toAtm(s); break;
237 case Type::Line: mline = toLine(s); break;
238 case Type::Sensor: msensor = toSensor(s); break;
239 case Type::Special: mspecial = toSpecial(s); break;
240 case Type::FINAL: { /* leave last, don't use default */ }
241 }
242 }
243
244 std::string_view TargetSubType() const noexcept {
245 switch (mtype) {
246 case Type::Atm: return toString(matm);
247 case Type::Line: return toString(mline);
248 case Type::Sensor: return toString(msensor);
249 case Type::Special: return toString(mspecial);
250 case Type::FINAL: { /* leave last, don't use default */ }
251 }
252 return "BAD SUBTYPE";
253 }
254
256 bool TargetTypeOK() const noexcept {return good_enum(mtype);}
257
259 bool TargetSubTypeOK() const noexcept {
260 // We can only hold one valid enum at a time, and it must be of the correct type
261 if (1 == (good_enum(mspecial) + good_enum(msensor) + good_enum(mline) + good_enum(matm))) {
262 switch (mtype) {
263 case Type::Special:
264 return good_enum(mspecial);
265 case Type::Sensor:
266 return good_enum(msensor);
267 case Type::Line:
268 return good_enum(mline);
269 case Type::Atm:
270 return good_enum(matm);
271 case Type::FINAL: { /* leave last, don't use default */ }
272 }
273 }
274
275 return false;
276 }
277
279 bool isSpeciesVMR() const noexcept {
280 return mline == Line::VMR or mspecial == Special::ArrayOfSpeciesTagVMR;
281 }
282
284 bool isWind() const noexcept {
285 return matm == Atm::WindMagnitude or
286 matm == Atm::WindU or
287 matm == Atm::WindV or
288 matm == Atm::WindW;
289 }
290
292 bool isMagnetic() const noexcept {
293 return matm == Atm::MagneticMagnitude or
294 matm == Atm::MagneticU or
295 matm == Atm::MagneticV or
296 matm == Atm::MagneticW;
297 }
298
300 bool isFrequency() const noexcept {
301 return msensor == Sensor::FrequencyStretch or
302 msensor == Sensor::FrequencyShift;
303 }
304
306 bool isPointing() const noexcept {
307 return msensor == Sensor::PointingZenithInterp or
308 msensor == Sensor::PointingZenithRecalc;
309 }
310
312 bool needQuantumIdentity() const noexcept {
313 return mtype == Type::Line;
314 }
315
317 bool needArrayOfSpeciesTag() const noexcept {
318 return mspecial == Special::ArrayOfSpeciesTagVMR;
319 }
320
322 bool needString() const noexcept {
323 return mspecial == Special::ScatteringString or
324 mspecial == Special::SurfaceString;
325 }
326
327 const Species::Species& LineSpecies() const noexcept {return mspecid;}
328 Species::Species& LineSpecies() noexcept {return mspecid;}
329 void LineSpecies(Species::Species x) noexcept {mspecid = x;}
330}; // Target
331
338std::ostream& operator<<(std::ostream& os, const Target& x);
339}; // Jacobian
340using JacobianTarget = Jacobian::Target;
342
343
346 public:
349 : msubtag(),
350 msubsubtag(),
351 mmode(),
352 mgrids(),
353 mjac() { /* Nothing to do here. */
354 }
355
365 RetrievalQuantity(const Jacobian::Target& target,
366 const String& subtag,
367 const String& subsubtag,
368 const String& mode,
369 const Numeric& perturbation,
370 const ArrayOfVector& grids)
371 : msubtag(subtag),
372 msubsubtag(subsubtag),
373 mmode(mode),
374 mgrids(grids),
375 mjac(target) {
376 mjac.Perturbation() = perturbation;
377 }
378
385 const String& Subtag() const { return msubtag; }
386
391 void Subtag(const String& st) { msubtag = st; }
392
399 const String& SubSubtag() const { return msubsubtag; }
400
405 void SubSubtag(const String& sst) { msubsubtag = sst; }
406
414 const String& Mode() const { return mmode; }
415
420 void Mode(const String& m) { mmode = m; }
421
428 const ArrayOfVector& Grids() const { return mgrids; }
429
434 void Grids(const ArrayOfVector& g) { mgrids = g; }
435
442 Index nelem() const {
443 Index i = 1;
444 for (Index j = 0; j < mgrids.nelem(); ++j) {
445 i *= mgrids[j].nelem();
446 }
447 return i;
448 }
449
451 Jacobian::Target& Target() {return mjac;}
452
454 const Jacobian::Target& Target() const {return mjac;}
455
457 void Target(const Jacobian::Target& jac) {mjac=jac;}
458
466 return mjac.QuantumIdentity();
467 }
468
470 Jacobian::Line LineType() const noexcept {return mjac.LineType();}
471
473 bool operator==(Jacobian::Atm other) const noexcept {return mjac==other;}
474
476 bool operator==(Jacobian::Line other) const noexcept {return mjac==other;}
477
479 bool operator==(Jacobian::Sensor other) const noexcept {return mjac==other;}
480
482 bool operator==(Jacobian::Special other) const noexcept {return mjac==other;}
483
485 bool operator==(Jacobian::Type other) const noexcept {return mjac==other;}
486
488 bool operator==(const ArrayOfSpeciesTag& st) const noexcept {return mjac==Jacobian::Special::ArrayOfSpeciesTagVMR and mjac.SpeciesList() == st;}
489
494 void QuantumIdentity(const QuantumIdentifier& qi) { mjac.QuantumIdentity() = qi; }
495
497 bool propmattype() const noexcept {
498 return mjac == Jacobian::Type::Line or
499 mjac == Jacobian::Type::Atm or
500 mjac == Jacobian::Special::ArrayOfSpeciesTagVMR;
501 }
502
503 bool is_wind() const noexcept {return mjac.isWind();}
504
505 bool is_mag() const noexcept {return mjac.isMagnetic();}
506
516 bool HasAffine() const { return !transformation_matrix.empty(); }
518 const Vector& TFuncParameters() const { return tfunc_parameters; }
520 const Vector& OffsetVector() const { return offset_vector; }
521
529 return a.msubtag == msubtag and
530 a.msubsubtag == msubsubtag and a.mmode == mmode and
531 a.mjac.sameTargetType(mjac);
532 }
533
534 String& SubTag() {return msubtag;}
536 String& Mode() {return mmode;}
542
543 private:
548 Jacobian::Target mjac;
549
552
555};
556
558ostream& operator<<(ostream& os, const RetrievalQuantity& ot);
559
561
562// A macro to loop analytical jacobian quantities
563#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do) \
564 for (Index iq = 0; iq < jacobian_quantities.nelem(); iq++) { \
565 if (not(jacobian_quantities[iq] == Jacobian::Type::Sensor) and \
566 not(jacobian_quantities[iq] == Jacobian::Special::SurfaceString)) { \
567 what_to_do \
568 } \
569 }
570// A macro to loop analytical jacobian quantities
571#define FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do) \
572 for (Index iq = 0; iq < jacobian_quantities.nelem(); iq++) { \
573 if (not(jacobian_quantities[iq] == Jacobian::Type::Sensor)) { \
574 what_to_do \
575 } \
576 }
577
578//======================================================================
579// Index ranges and transformation functions
580//======================================================================
581
600 bool& any_affine,
601 const ArrayOfRetrievalQuantity& jqs,
602 const bool& before_affine = false);
603
612void transform_jacobian(Matrix& jacobian,
613 const Vector x,
614 const ArrayOfRetrievalQuantity& jqs);
615
626void transform_x(Vector& x, const ArrayOfRetrievalQuantity& jqs);
627
638void transform_x_back(Vector& x_t,
639 const ArrayOfRetrievalQuantity& jqs,
640 bool revert_functional_transforms = true);
641
642//======================================================================
643// Functions related to calculation of Jacobian
644//======================================================================
645
676 ostringstream& os,
677 const Vector& p_grid,
678 const Vector& lat_grid,
679 const Vector& lon_grid,
680 const Vector& p_retr,
681 const Vector& lat_retr,
682 const Vector& lon_retr,
683 const String& p_retr_name,
684 const String& lat_retr_name,
685 const String& lon_retr_name,
686 const Index& dim);
687
688
715 ostringstream& os,
716 const Vector& lat_grid,
717 const Vector& lon_grid,
718 const Vector& lat_retr,
719 const Vector& lon_retr,
720 const String& lat_retr_name,
721 const String& lon_retr_name,
722 const Index& dim);
723
738 const RetrievalQuantity& jacobian_quantity,
739 ConstTensor3View diy_dpath,
740 const Index& atmosphere_dim,
741 const Ppath& ppath,
742 ConstVectorView ppath_p);
743
758 const RetrievalQuantity& jacobian_quantity,
759 ConstMatrixView diy_dpos,
760 const Index& atmosphere_dim,
761 ConstVectorView rtp_pos);
762
779ArrayOfTensor3 get_standard_diy_dpath(const ArrayOfRetrievalQuantity& jacobian_quantities, Index np, Index nf, Index ns, bool active);
780
796ArrayOfTensor3 get_standard_starting_diy_dx(const ArrayOfRetrievalQuantity& jacobian_quantities, Index np, Index nf, Index ns, bool active);
797
818 const ArrayOfArrayOfSpeciesTag& abs_species);
819
840 const ArrayOfString& scat_species,
841 const bool cloudbox_on);
842
857template <std::size_t N>
859 static_assert(N == 1 or N == 2, "FOR_ANALYTICAL_JACOBIANS_DO or FOR_ANALYTICAL_JACOBIANS_DO2");
860 if constexpr (N == 1) FOR_ANALYTICAL_JACOBIANS_DO(return 1;)
861 else if constexpr (N == 2) FOR_ANALYTICAL_JACOBIANS_DO2(return 1;)
862 return 0;
863}
864
882
897void polynomial_basis_func(Vector& b, const Vector& x, const Index& poly_coeff);
898
919void calcBaselineFit(Vector& y_baseline,
920 const Vector& x,
921 const Index& mblock_index,
922 const Sparse& sensor_response,
923 const ArrayOfIndex& sensor_response_pol_grid,
924 const Vector& sensor_response_f_grid,
925 const Matrix& sensor_response_dlos_grid,
926 const RetrievalQuantity& rq,
927 const Index rq_index,
928 const ArrayOfArrayOfIndex& jacobian_indices);
929
945void vmrunitscf(Numeric& x,
946 const String& unit,
947 const Numeric& vmr,
948 const Numeric& p,
949 const Numeric& t);
950
967void dxdvmrscf(Numeric& x,
968 const String& unit,
969 const Numeric& vmr,
970 const Numeric& p,
971 const Numeric& t);
972
973//======================================================================
974// Propmat partials descriptions
975//======================================================================
976
983
990
997 const ArrayOfRetrievalQuantity& js) noexcept;
998
1007
1008//======================================================================
1009// Propmat partials boolean functions
1010//======================================================================
1011
1018bool is_frequency_parameter(const RetrievalQuantity& t) noexcept;
1019
1026bool is_derived_magnetic_parameter(const RetrievalQuantity& t) noexcept;
1027
1034bool is_nlte_parameter(const RetrievalQuantity& t) noexcept;
1035
1043
1053
1061
1071
1081
1091
1101
1111
1121
1130bool is_lineshape_parameter_X0(const RetrievalQuantity& t) noexcept;
1131
1140bool is_lineshape_parameter_X1(const RetrievalQuantity& t) noexcept;
1141
1150bool is_lineshape_parameter_X2(const RetrievalQuantity& t) noexcept;
1151
1161
1170bool is_lineshape_parameter(const RetrievalQuantity& t) noexcept;
1171
1178bool is_line_parameter(const RetrievalQuantity& t) noexcept;
1179
1187
1195
1196
1204
1212
1220
1228
1236
1244
1254bool species_match(const RetrievalQuantity& rq, const ArrayOfSpeciesTag& ast);
1255
1263bool species_match(const RetrievalQuantity& rq, const Species::Species species);
1264
1274 const Species::IsotopeRecord& ir);
1275
1282bool do_temperature_jacobian(const ArrayOfRetrievalQuantity& js) noexcept;
1283
1286 bool test;
1288};
1289
1300 const QuantumIdentifier& line_qid) noexcept;
1301
1308bool do_line_center_jacobian(const ArrayOfRetrievalQuantity& js) noexcept;
1309
1316bool do_frequency_jacobian(const ArrayOfRetrievalQuantity& js) noexcept;
1317
1324bool do_magnetic_jacobian(const ArrayOfRetrievalQuantity& js) noexcept;
1325
1326#endif // jacobian_h
Declarations for agendas.
This file contains the definition of Array.
This file contains the class declaration of bifstream.
This can be used to make arrays out of anything.
Definition: array.h:107
Index nelem() const ARTS_NOEXCEPT
Number of elements.
Definition: array.h:195
A constant view of a Matrix.
Definition: matpackI.h:1014
bool empty() const ARTS_NOEXCEPT
Returns true if variable size is zero.
Definition: matpackI.cc:430
A constant view of a Tensor3.
Definition: matpackIII.h:132
A constant view of a Vector.
Definition: matpackI.h:489
The Matrix class.
Definition: matpackI.h:1225
Deals with internal derivatives, Jacobian definition, and OEM calculations.
Definition: jacobian.h:345
Vector tfunc_parameters
Definition: jacobian.h:551
const Matrix & TransformationMatrix() const
Definition: jacobian.h:519
bool operator==(const ArrayOfSpeciesTag &st) const noexcept
Return special type equality.
Definition: jacobian.h:488
bool is_wind() const noexcept
Definition: jacobian.h:503
Vector offset_vector
Definition: jacobian.h:554
void Subtag(const String &st)
Sets the sub-tag.
Definition: jacobian.h:391
bool HasAffine() const
Definition: jacobian.h:516
const String & Mode() const
Returns the mode.
Definition: jacobian.h:414
const String & TransformationFunc() const
Definition: jacobian.h:517
bool operator==(Jacobian::Type other) const noexcept
Return special type equality.
Definition: jacobian.h:485
void SetTransformationMatrix(const Matrix &A)
Definition: jacobian.h:514
void Target(const Jacobian::Target &jac)
Set the Jacobian Target.
Definition: jacobian.h:457
void SetTFuncParameters(const Vector &p)
Definition: jacobian.h:513
Vector & TFuncParameters()
Definition: jacobian.h:539
Matrix & Transformation()
Definition: jacobian.h:540
String & SubTag()
Definition: jacobian.h:534
Index nelem() const
Number of elements in the grids.
Definition: jacobian.h:442
bool operator==(Jacobian::Special other) const noexcept
Return special type equality.
Definition: jacobian.h:482
void QuantumIdentity(const QuantumIdentifier &qi)
Sets the identity of this Jacobian.
Definition: jacobian.h:494
String & TransformationFunc()
Definition: jacobian.h:538
void SetTransformationFunc(const String &s)
Transformation.
Definition: jacobian.h:512
const Vector & TFuncParameters() const
Definition: jacobian.h:518
Matrix transformation_matrix
Definition: jacobian.h:553
Jacobian::Target mjac
Definition: jacobian.h:548
const Vector & OffsetVector() const
Definition: jacobian.h:520
Jacobian::Target & Target()
Get the Jacobian Target.
Definition: jacobian.h:451
String msubsubtag
Definition: jacobian.h:545
bool HasSameInternalsAs(const RetrievalQuantity &a) const
Checks that all the internal variables of *this match with those of the input.
Definition: jacobian.h:528
void SubSubtag(const String &sst)
Sets the sub-sub-tag.
Definition: jacobian.h:405
const String & SubSubtag() const
Returns the sub-sub-tag.
Definition: jacobian.h:399
Vector & Offset()
Definition: jacobian.h:541
String transformation_func
Definition: jacobian.h:550
bool operator==(Jacobian::Line other) const noexcept
Return line type equality.
Definition: jacobian.h:476
const QuantumIdentifier & QuantumIdentity() const
Returns the identity of this Jacobian.
Definition: jacobian.h:465
void SetOffsetVector(const Vector &b)
Definition: jacobian.h:515
bool is_mag() const noexcept
Definition: jacobian.h:505
void Grids(const ArrayOfVector &g)
Sets the grids of the retrieval.
Definition: jacobian.h:434
RetrievalQuantity(const Jacobian::Target &target, const String &subtag, const String &subsubtag, const String &mode, const Numeric &perturbation, const ArrayOfVector &grids)
Constructor that sets the values.
Definition: jacobian.h:365
void Mode(const String &m)
Sets the mode.
Definition: jacobian.h:420
String & SubSubTag()
Definition: jacobian.h:535
String & Mode()
Definition: jacobian.h:536
ArrayOfVector & Grids()
Definition: jacobian.h:537
const ArrayOfVector & Grids() const
Returns the grids of the retrieval.
Definition: jacobian.h:428
bool operator==(Jacobian::Sensor other) const noexcept
Return sensor type equality.
Definition: jacobian.h:479
const String & Subtag() const
Returns the sub-tag.
Definition: jacobian.h:385
const Jacobian::Target & Target() const
Get the Jacobian Target.
Definition: jacobian.h:454
bool operator==(Jacobian::Atm other) const noexcept
Return atm type equality.
Definition: jacobian.h:473
bool propmattype() const noexcept
Returns if this is a propagation matrix type.
Definition: jacobian.h:497
RetrievalQuantity()
Default constructor.
Definition: jacobian.h:348
Jacobian::Line LineType() const noexcept
Return line type.
Definition: jacobian.h:470
ArrayOfVector mgrids
Definition: jacobian.h:547
The Sparse class.
Definition: matpackII.h:67
The Tensor3View class.
Definition: matpackIII.h:239
The Vector class.
Definition: matpackI.h:876
#define ARTS_ASSERT(condition,...)
Definition: debug.h:83
constexpr bool good_enum(EnumType x) noexcept
Checks if the enum number is good.
Definition: enums.h:21
Header file for interpolation.cc.
void transform_x_back(Vector &x_t, const ArrayOfRetrievalQuantity &jqs, bool revert_functional_transforms=true)
Handles back-transformations of the state vector.
Definition: jacobian.cc:232
void dxdvmrscf(Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t)
Scale factor for conversion of derivatives with respect to VMR.
Definition: jacobian.cc:978
bool species_iso_match(const RetrievalQuantity &rq, const Species::IsotopeRecord &ir)
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags.
Definition: jacobian.cc:1138
ArrayOfIndex get_pointers_for_analytical_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfArrayOfSpeciesTag &abs_species)
Help function for analytical jacobian calculations.
Definition: jacobian.cc:564
void vmrunitscf(Numeric &x, const String &unit, const Numeric &vmr, const Numeric &p, const Numeric &t)
Scale factor for conversion between gas species units.
Definition: jacobian.cc:951
bool is_pressure_broadening_D0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a D0 derivative.
bool supports_propmat_clearsky(const ArrayOfRetrievalQuantity &js)
Returns if the array supports propagation matrix derivatives.
Definition: jacobian.cc:1110
void diy_from_pos_to_rgrids(Tensor3View diy_dx, const RetrievalQuantity &jacobian_quantity, ConstMatrixView diy_dpos, const Index &atmosphere_dim, ConstVectorView rtp_pos)
diy_from_pos_to_rgrids
Definition: jacobian.cc:474
bool is_pressure_broadening_Y(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a Y derivative.
bool do_line_center_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a line center derivative.
Definition: jacobian.cc:1164
ArrayOfTensor3 get_standard_starting_diy_dx(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
Definition: jacobian.cc:605
void polynomial_basis_func(Vector &b, const Vector &x, const Index &poly_coeff)
Calculates polynomial basis functions.
Definition: jacobian.cc:847
bool supports_CIA(const ArrayOfRetrievalQuantity &js)
Returns if the array supports CIA derivatives.
Definition: jacobian.cc:1084
bool is_pressure_broadening_DV(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a DV derivative.
Index do_analytical_jacobian(const ArrayOfRetrievalQuantity &jacobian_quantities)
Checks if analytical calculations are needed at all.
Definition: jacobian.h:858
void transform_jacobian(Matrix &jacobian, const Vector x, const ArrayOfRetrievalQuantity &jqs)
Applies both functional and affine transformations.
Definition: jacobian.cc:90
bool is_pressure_broadening_G0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0 derivative.
void jac_ranges_indices(ArrayOfArrayOfIndex &jis, bool &any_affine, const ArrayOfRetrievalQuantity &jqs, const bool &before_affine=false)
Determines the index range inside x and the Jacobian for each retrieval quantity.
Definition: jacobian.cc:45
bool is_pressure_broadening_FVC(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a FVC derivative.
bool is_lineshape_parameter_X1(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a X1 derivative.
Definition: jacobian.cc:1040
Jacobian::Target JacobianTarget
Definition: jacobian.h:340
bool is_lineshape_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC, Y, G, DV derivative.
Definition: jacobian.cc:1072
bool supports_relaxation_matrix(const ArrayOfRetrievalQuantity &js)
Returns if the array supports relaxation matrix derivatives.
Definition: jacobian.cc:1098
bool supports_zeeman(const ArrayOfRetrievalQuantity &js)
Returns if the array supports Zeeman derivatives.
bool do_frequency_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a frequency derivative.
Definition: jacobian.cc:1168
bool is_pressure_broadening_D2(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a D2 derivative.
Array< RetrievalQuantity > ArrayOfRetrievalQuantity
Definition: jacobian.h:560
bool is_derived_magnetic_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a derived magnetic parameter.
Definition: jacobian.cc:1005
bool supports_continuum(const ArrayOfRetrievalQuantity &js)
Returns if the array supports continuum derivatives.
Definition: jacobian.cc:1092
bool is_pressure_broadening_G(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G derivative.
bool species_match(const RetrievalQuantity &rq, const ArrayOfSpeciesTag &ast)
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags.
Definition: jacobian.cc:1114
bool do_magnetic_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a magnetic derivative.
Definition: jacobian.cc:1172
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
Definition: jacobian.cc:1147
ArrayOfTensor3 get_standard_diy_dpath(const ArrayOfRetrievalQuantity &jacobian_quantities, Index np, Index nf, Index ns, bool active)
Help function for analytical jacobian calculations.
Definition: jacobian.cc:596
bool supports_hitran_xsec(const ArrayOfRetrievalQuantity &js)
Returns if the array supports HITRAN cross-section derivatives.
Definition: jacobian.cc:1088
bool supports_lookup(const ArrayOfRetrievalQuantity &js)
Returns if the array supports lookup table derivatives.
Definition: jacobian.cc:1104
ArrayOfIndex get_pointers_for_scat_species(const ArrayOfRetrievalQuantity &jacobian_quantities, const ArrayOfString &scat_species, const bool cloudbox_on)
Help function for analytical jacobian calculations.
Definition: jacobian.cc:618
bool is_lineshape_parameter_X2(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a X2 derivative.
Definition: jacobian.cc:1048
bool is_pressure_broadening_G2(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0 derivative.
bool is_pressure_broadening_ETA(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a ETA derivative.
Numeric magnetic_field_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the magnetic field perturbation if it exists.
Definition: jacobian.cc:1192
void diy_from_path_to_rgrids(Tensor3View diy_dx, const RetrievalQuantity &jacobian_quantity, ConstTensor3View diy_dpath, const Index &atmosphere_dim, const Ppath &ppath, ConstVectorView ppath_p)
Maps jacobian data for points along the propagation path, to jacobian retrieval grid data.
Definition: jacobian.cc:312
String propmattype_string(const RetrievalQuantity &rq)
Returns a string of the retrieval quantity propagation matrix type.
bool is_nlte_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a NLTE parameter.
Definition: jacobian.cc:1009
#define FOR_ANALYTICAL_JACOBIANS_DO2(what_to_do)
Definition: jacobian.h:571
bool is_frequency_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
Definition: jacobian.cc:1001
#define FOR_ANALYTICAL_JACOBIANS_DO(what_to_do)
Definition: jacobian.h:563
bool check_retrieval_grids(ArrayOfVector &grids, ostringstream &os, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Vector &p_retr, const Vector &lat_retr, const Vector &lon_retr, const String &p_retr_name, const String &lat_retr_name, const String &lon_retr_name, const Index &dim)
Check that the retrieval grids are defined for each atmosphere dim.
Definition: jacobian.cc:640
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
Definition: jacobian.cc:1176
jacobianVMRcheck do_vmr_jacobian(const ArrayOfRetrievalQuantity &js, const QuantumIdentifier &line_qid) noexcept
Returns the required info for VMR Jacobian.
Definition: jacobian.cc:1151
Numeric frequency_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the frequency perturbation if it exists.
Definition: jacobian.cc:1184
void jacobian_type_extrapol(ArrayOfGridPos &gp)
Adopts grid positions to extrapolation used for jacobians.
Definition: jacobian.cc:835
bool is_lineshape_parameter_X0(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a X0 derivative.
Definition: jacobian.cc:1032
void transform_x(Vector &x, const ArrayOfRetrievalQuantity &jqs)
Handles transformations of the state vector.
Definition: jacobian.cc:155
bool supports_faraday(const ArrayOfRetrievalQuantity &js)
Returns if the array supports Faraday derivatives.
ostream & operator<<(ostream &os, const RetrievalQuantity &ot)
Output operator for RetrievalQuantity.
Definition: jacobian.cc:39
void calcBaselineFit(Vector &y_baseline, const Vector &x, const Index &mblock_index, const Sparse &sensor_response, const ArrayOfIndex &sensor_response_pol_grid, const Vector &sensor_response_f_grid, const Matrix &sensor_response_dlos_grid, const RetrievalQuantity &rq, const Index rq_index, const ArrayOfArrayOfIndex &jacobian_indices)
Calculate baseline fit.
Definition: jacobian.cc:871
bool is_lineshape_parameter_bar_linemixing(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a G0, D0, G2, D2, ETA, FVC derivative.
Definition: jacobian.cc:1065
bool is_line_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is related to the absorption line.
Definition: jacobian.cc:1080
#define ns
Header file for logic.cc.
Implementation of Matrix, Vector, and such stuff.
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Declaration of the class MdRecord.
This file contains the definition of String, the ARTS string class.
char Type type
Particulates Polyfit
Definition: jacobian.h:86
std::ostream & operator<<(std::ostream &os, const Target &x)
Output operator.
Definition: jacobian.cc:1200
Particulates FrequencyStretch
Definition: jacobian.h:85
ENUMCLASS(Type, char, Atm, Line, Sensor, Special) ENUMCLASS(Atm
Holds the type of the target quantity.
Temperature
Definition: jacobian.h:57
Particulates FrequencyShift
Definition: jacobian.h:84
Particulates Sinefit
Definition: jacobian.h:87
Particulates PointingZenithInterp
Definition: jacobian.h:88
MagneticMagnitude
Definition: jacobian.h:59
WindMagnitude
Definition: jacobian.h:58
Propagation path structure and functions.
#define a
#define b
constexpr bool operator==(const QuantumNumbers &a, const QuantumNumbers &b)
Check if all quantum numbers are the same between a and b.
Definition: quantum.h:257
Quantum::Identifier QuantumIdentifier
Definition: quantum.h:471
#define N
Definition: rng.cc:164
The structure to describe a propagation path and releated quantities.
Definition: ppath.h:48
Struct containing all information needed about one isotope.
Definition: isotopologues.h:14
Deals with whether or not we should do a VMR derivative.
Definition: jacobian.h:1285
const QuantumIdentifier & qid
Definition: jacobian.h:1287