Bases: eoldaslib.eoldas_ParamStorage.ParamStorage
A generic class for the EOLDAS operator
Methods
The default operator: an identity operator
This should return self.linear.H with dimensions the same as y if there is a y state. Otherwise, it is assumed of size x.
The default differential operator
dH(x)/dx
Here, we return a full matrix but that is not always needed as it can be large for large problems
It may be called by J_prime_prime if there is no better way to calculate J_prime_prime
If you want to circumvent
Not yet implemented
d^2H(x)/dxi dxj
The operator contribution to the cost function:
J = 0.5 (y - H(x))^T (C_y^-1 + C_H(x)^-1) (y - H(x))
This is a single value, J
A call to self.J that also loads x
Required by self.J_prime_approx_3()
The operator contribution to the cost function:
J’ = dJ/dx = (y - H(x))^T (C_y^-1) H’(x)
This should be of dimensions n_
A discrete approximation to J_prime
The method assumes that J_prime is independent for each sample in the last column of the state vector.
This will be appropriate e.g. for observation operators where the derivative of one observation does does not depend on any other samples. This means that we can take finite difference steps only over this last dimension and not over all samples.
see also:
J_prime_approx_3 J_prime_approx_2 (not yet implemented)
A discrete approximation to J_prime
This method is the ‘backup’ and default approximation method for J_prime as it treats all samples independently and so has to go ober x.size finite steps for J.
Generally, J_prime_approx_2 or J_prime_approx_1 will be significantly faster than this, but there may be occasions when this method is appropriate.
The method makes use of and requires DerApproximator so will only work if this python library is available.
It might be adviseable at some point to write a backup method in case that is not installed, but thats not a very good use of time really ...
The operator contribution to the cost function:
J’’ = d^2J/(dx_idx_j)
Here, this is simply Cy^-1
NB: if you inherit this class you must
define a new J_prime_prime if you want to calculate uncertainties
or sel J_prime_prime to return J_prime_prime_approx
The operator contribution to the cost function:
J’’ = d^2J/(dx_idx_j)
numerically.
This is costly and you can normally find a better way to do it.
If the Operator is a super operator it may contain other operators in self.operators in which case, cost() returns J and J_prime for all sub operators
If not, then just calculate the cost in this operator. Note that in the case of a super operator, we do not count self cost.
Calculate the fwd modelling uncertainty for all operators
This assumes that self.Ihessian has been calculated
For each operator then, op.fwdUncert = H_prime.T self.Ihessian H_prime
If the Operator is a super operator it may contain other operators in self.operators in which case, cost() returns J_prime_prime summed for all sub operators
If not, then just calculate the J_prime_prime in this operator. Note that in the case of a super operator, we do not count self cost.
Apply the inverse transform to the state vector if it is defined
Utility to load the state vector required here (self.input_x) from fullx
This is done using a mask, in loader_prep which can be used in reverse in the unloader. The mask is stored as self.loaderMask
Form a plot of the x & y state
A method that gets accessed after data are loaded. You should think of this as a hook so that you don’t have to write a whole new __init__ method.
In this default method, we use it to declare that the operator is linear (self.isLinear = True) and also to set up H_prime for an identity operator.
A method that gets accessed before data are loaded. You should think of this as a hook so that you don’t have to write a whole new __init__ method.
Utility to return a full state vector representation from one that may be only partial
If sum is True, then if multiple items appear per location they are summed. That is a bit fiddly, but is needed e.g. for loading derivative data.
If sum is False, then only the first instance we come across is loaded.
If M is True, then we are unloading a matrix which will normally be the hessian
A write method for outputting state variables
e.g. self.write(‘xxx.dat’,’x’,fmt=’PARAMETERS’)
Will also do basic plotting of state and observations if possible.
Derivative test for individual J_primes