Functions

src/inversion/Model.c File Reference

Functions

void initializeModel (Model *model, int X, int Y, int M, int Z)
void initializeOutputModel (Model *model, MAP_DEPTH_MATRIX kernelTdm)
void initializeForwardOutputModel (Model *model, MAP_DEPTH_MATRIX kernelTdm)
void initializeCalcQOutputModel (Model *model, MAP_DEPTH_MATRIX w)
void freeModel (Model *model)
void useNoMaps (Model *model)
void setParameters (Model *model, Float mu, Float sigma)
void setParameters2 (Model *model, Float *values, int nValues)
void clearParameters (Model *model)
void saveW (Model *model, MATRIX w, int kx, int ky)
void saveB (Model *model, MATRIX b, int nStep)
MATRIX calculateQK (MATRIX wk, MAP_DEPTH_MATRIX tau, int kx, int ky)
MATRIX calculateAvgK (MATRIX wk, MAP_DEPTH_MATRIX K, int kx, int ky)
MATRIX calculateNoiseK (MATRIX wk, MAP_DEPTH_MATRIX Lambda, int kx, int ky)
void calculateQValues (Model *model, MAP_DEPTH_MATRIX tau, bool DValueShift)
void calculateDerivedValues (Model *model, MAP_DEPTH_MATRIX K, MAP_DEPTH_MATRIX tau, MAP_DEPTH_MATRIX Lambda, bool DValueShift)
void calculateDerivedValuesNoQ (Model *model, MAP_DEPTH_MATRIX K, MAP_DEPTH_MATRIX Lambda, bool DValueShift)
void writeQ (Model *model, BaseDirectory *baseName)
void writeW (Model *model, BaseDirectory *baseName)
void writeAvgKern (Model *model, BaseDirectory *baseName)
void writeAVectors1d (Model *model, BaseDirectory *baseName, Float lambda)
void writeNoise (Model *model, BaseDirectory *baseName)
void writeCovVectors1d (Model *model, BaseDirectory *baseName, Float lambda)
void writeBVectors1d (Model *model, BaseDirectory *baseName)
void writeBVectors3d (Model *model, BaseDirectory *baseName)
void saveGridValues (Model *m, int r, int c, Float kx, Float ky, Float lambda)
void writeGridValues3d (Model *model, BaseDirectory *baseName)
void writeDTildaValues3d (Model *model, BaseDirectory *baseName, bool useFT)
void writeAvgKernValues3d (Model *model, BaseDirectory *baseName)

Function Documentation

MATRIX calculateAvgK ( MATRIX  wk,
MAP_DEPTH_MATRIX  K,
int  kx,
int  ky 
)

Calculate the averaging kernel at a given kx, ky in wave space.

Parameters:
[in] wk A MATRIX containing the solution weights at a specific kx,ky in wave space.
[in] K A MAP_DEPTH_MATRIX containing the kernels.
[in] kx The x-coordinate in wave space.
[in] ky The y-coordinate in wave space.
Returns:
a Matrix containing the averaging kernel at a particular kx,ky.
void calculateDerivedValues ( Model model,
MAP_DEPTH_MATRIX  K,
MAP_DEPTH_MATRIX  tau,
MAP_DEPTH_MATRIX  Lambda,
bool  DValueShift 
)

Calculate q, Averaging Kernel and noise squared.

Parameters:
[in] model A Model object.
[in] K Kernel matrix
[in] tau Travel-map matrix
[in] Lambda Travel-map noise covariance matrix
[in] DValueShift Boolean indicating whether to shift output matrices q, and averaging kernel, and noise.
void calculateDerivedValuesNoQ ( Model model,
MAP_DEPTH_MATRIX  K,
MAP_DEPTH_MATRIX  Lambda,
bool  DValueShift 
)
MATRIX calculateNoiseK ( MATRIX  wk,
MAP_DEPTH_MATRIX  Lambda,
int  kx,
int  ky 
)

Calculate the noise at a given kx, ky in wave space.

Parameters:
[in] wk A MATRIX containing the solution weights at a specific kx,ky in wave space.
[in] Lambda A MAP_DEPTH_MATRIX containing the input covariance.
[in] kx The x-coordinate in wave space.
[in] ky The y-coordinate in wave space.
Returns:
a Matrix containing the averaging kernel at a particular kx,ky.
MATRIX calculateQK ( MATRIX  wk,
MAP_DEPTH_MATRIX  tau,
int  kx,
int  ky 
)

Calculate the model, q, at a given kx, ky in wave space.

Parameters:
[in] wk A MATRIX containing the solution weights at a specific kx,ky in wave space.
[in] tau Travel-map matrix
[in] kx The x-coordinate in wave space.
[in] ky The y-coordinate in wave space.
Returns:
a Matrix containing the model, q, at a particular kx,ky.
void calculateQValues ( Model model,
MAP_DEPTH_MATRIX  tau,
bool  DValueShift 
)

Calculate q

Parameters:
[in] model A Model object.
[in] tau Travel-map matrix
[in] DValueShift Boolean indicating whether to shift output matrix q.
void clearParameters ( Model model  ) 

Clear parameter values (mu and sigma) in the model. Output FITS files will not have sigma and mu parameters in the header.

Parameters:
[in,out] model A Model object.
void freeModel ( Model model  ) 

Free all memory associated with outputModel.

void initializeCalcQOutputModel ( Model model,
MAP_DEPTH_MATRIX  w 
)
void initializeForwardOutputModel ( Model model,
MAP_DEPTH_MATRIX  kernelTdm 
)

Initialize output model for use by forward calculation

Parameters:
[in,out] model Pointer to Model structure
[in] kernelTdm Matrix containing 3D Kernel.
void initializeModel ( Model model,
int  X,
int  Y,
int  M,
int  Z 
)

Initialize Model object, allocate space for data and constant values. Use for OLA inversions.

Parameters:
[in,out] model Initialize this Model.
[in] X Number of grid points, Nx
[in] Y Number of grid points, Ny
[in] M Number of measurements
[in] Z Number of grid points, Nz
void initializeOutputModel ( Model model,
MAP_DEPTH_MATRIX  kernelTdm 
)

Initialize output model for use by RLS inversion

Parameters:
[in,out] model Pointer to Model structure
[in] kernelTdm Matrix containing 3D RLS Kernel.
void saveB ( Model model,
MATRIX  b,
int  nStep 
)

Save inversion solution, b, for RLS 1D.

Parameters:
[in,out] model A Model object.
[in] b Solution matrix.
[in] nStep Parameter step number.
void saveGridValues ( Model m,
int  r,
int  c,
Float  kx,
Float  ky,
Float  lambda 
)

Save lambda values and kx, ky values for each wave number (RLS 3D inversion).

Parameters:
[in,out] m A Model object.
[in] r Row (index into matrix).
[in] c Column (index into matrix).
[in] kx Value of kx at (x,y)
[in] ky Value of ky at (x,y)
[in] lambda Value of lambda (regularization) parameter.
void saveW ( Model model,
MATRIX  w,
int  kx,
int  ky 
)

Save inversion weights, w, for wave number, kx, ky.

Parameters:
[in,out] model A Model object.
[in] w Inversion weights.
[in] kx X-index in Fourier space.
[in] ky Y-index in Fourier space.
void setParameters ( Model model,
Float  mu,
Float  sigma 
)

Record parameter values in the model.

Parameters:
[in,out] model A Model object.
[in] mu Value for mu parameter.
[in] sigma Value for sigma parameter.
void setParameters2 ( Model model,
Float values,
int  nValues 
)

Record multiple parameter values in the model.

Parameters:
[in,out] model A Model object.
[in] values Pointer to array of parameter values. NOTE: there is a special ordering to the parameters, mu, sigma, then nu (which is optional).
[in] nValues How many parameter values.
void useNoMaps ( Model model  ) 
void writeAVectors1d ( Model model,
BaseDirectory baseName,
Float  lambda 
)

Write the Averaging Kernel data for 1d problem.

Parameters:
[in] model The OutputModel containing the Averaging Kernel.
[in] baseName BaseDirectory structure for managing output file name.
[in] lambda Which lambda value was used for this solution.
void writeAvgKern ( Model model,
BaseDirectory baseName 
)

Write averaging kernel to file for OLA inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
void writeAvgKernValues3d ( Model model,
BaseDirectory baseName 
)

Write averaging kernels and error covariance matrices for RLS 3D inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
void writeBVectors1d ( Model model,
BaseDirectory baseName 
)

Write solution matrix for RLS 1D inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
void writeBVectors3d ( Model model,
BaseDirectory baseName 
)

Write solution B vectors to FITS files matrix for RLS 3D inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
void writeCovVectors1d ( Model model,
BaseDirectory baseName,
Float  lambda 
)

Write the Error Covariance data for 1d problem.

Parameters:
[in] model Model structure containing the Error Covariance.
[in] baseName Which lambda step was used for this solution.
[in] lambda Which lambda value was used for this solution.
void writeDTildaValues3d ( Model model,
BaseDirectory baseName,
bool  useFT 
)

Write d~ matrices for RLS 3D inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
[in] useFT Boolean indicates if d~ matrices should be Fourier transformed.
void writeGridValues3d ( Model model,
BaseDirectory baseName 
)

Write lambda values and kx, ky values for each wave number (RLS 3D inversion). Write kxGridValues, kyGridValues and lambdaGridValues at each grid point to FITS files matrix for RLS 3D inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
void writeNoise ( Model model,
BaseDirectory baseName 
)

Write noise estimate to file for OLA inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
void writeQ ( Model model,
BaseDirectory baseName 
)

Write solution, q, for OLA inversion.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
void writeW ( Model model,
BaseDirectory baseName 
)

Write OLA inversion weights, w, to file.

Parameters:
[in,out] model A Model object.
[in] baseName BaseDirectory structure for managing output file name.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines