milk  1.01
Modular Image processing Library toolKit
linopt_imtools.c File Reference

linear optimization tools More...

#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <malloc.h>
#include <math.h>
#include <stdlib.h>
#include <semaphore.h>
#include <sched.h>
#include <gsl/gsl_multimin.h>
#include <gsl/gsl_multifit.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_eigen.h>
#include <gsl/gsl_cblas.h>
#include <gsl/gsl_blas.h>
#include <time.h>
#include <fitsio.h>
#include "CommandLineInterface/CLIcore.h"
#include "COREMOD_tools/COREMOD_tools.h"
#include "COREMOD_memory/COREMOD_memory.h"
#include "COREMOD_arith/COREMOD_arith.h"
#include "COREMOD_iofits/COREMOD_iofits.h"
#include "statistic/statistic.h"
#include "info/info.h"
#include "linopt_imtools/linopt_imtools.h"
#include "cudacomp/cudacomp.h"
#include "CommandLineInterface/timeutils.h"
Include dependency graph for linopt_imtools.c:

Macros

#define MODULE_SHORTNAME_DEFAULT   "lintools"
 
#define MODULE_DESCRIPTION   "Image linear decomposition and optimization tools"
 

Functions

errno_t linopt_imtools_mask_to_pixtable_cli ()
 
errno_t linopt_imtools_Image_to_vec_cli ()
 
errno_t linopt_imtools_vec_to_2DImage_cli ()
 
errno_t linopt_imtools_makeCosRadModes_cli ()
 
errno_t linopt_imtools_makeCPAmodes_cli ()
 
errno_t linopt_imtools_image_construct_cli ()
 
errno_t linopt_imtools_image_construct_stream_cli ()
 
errno_t linopt_compute_SVDdecomp_cli ()
 
errno_t linopt_compute_SVDpseudoInverse_cli ()
 
errno_t linopt_compute_1Dfit_cli ()
 
errno_t linopt_imtools_image_fitModes_cli ()
 
errno_t linopt_compute_linRM_from_inout_cli ()
 
static errno_t init_module_CLI ()
 
long linopt_imtools_mask_to_pixtable (const char *IDmask_name, const char *IDpixindex_name, const char *IDpixmult_name)
 
imageID linopt_imtools_Image_to_vec (const char *ID_name, const char *IDpixindex_name, const char *IDpixmult_name, const char *IDvec_name)
 
imageID linopt_imtools_vec_to_2DImage (const char *IDvec_name, const char *IDpixindex_name, const char *IDpixmult_name, const char *ID_name, long xsize, long ysize)
 
imageID linopt_imtools_make1Dpolynomials (const char *IDout_name, long NBpts, long MaxOrder, float r0pix)
 
imageID linopt_imtools_makeCosRadModes (const char *ID_name, long size, long kmax, float radius, float radfactlim)
 
long linopt_imtools_makeCPAmodes (const char *ID_name, long size, float CPAmax, float deltaCPA, float radius, float radfactlim, int writeMfile)
 
double linopt_imtools_opt_f (const gsl_vector *v, __attribute__((unused)) void *params)
 
void linopt_imtools_opt_df (const gsl_vector *v, void *params, gsl_vector *df)
 
void linopt_imtools_opt_fdf (const gsl_vector *x, void *params, double *f, gsl_vector *df)
 
imageID linopt_imtools_image_construct (const char *IDmodes_name, const char *IDcoeff_name, const char *ID_name)
 
imageID linopt_imtools_image_construct_stream (const char *IDmodes_name, const char *IDcoeff_name, const char *IDout_name)
 
imageID linopt_compute_SVDdecomp (const char *IDin_name, const char *IDout_name, const char *IDcoeff_name)
 
imageID linopt_compute_SVDpseudoInverse (const char *ID_Rmatrix_name, const char *ID_Cmatrix_name, double SVDeps, long MaxNBmodes, const char *ID_VTmatrix_name)
 
imageID linopt_compute_1Dfit (const char *fnamein, long NBpt, long MaxOrder, const char *fnameout, int MODE)
 
imageID linopt_imtools_image_fitModes (const char *ID_name, const char *IDmodes_name, const char *IDmask_name, double SVDeps, const char *IDcoeff_name, int reuse)
 
double linopt_imtools_match_slow (const char *ID_name, const char *IDref_name, const char *IDmask_name, const char *IDsol_name, const char *IDout_name)
 
double linopt_imtools_match (const char *ID_name, const char *IDref_name, const char *IDmask_name, const char *IDsol_name, const char *IDout_name)
 
imageID linopt_compute_linRM_from_inout (const char *IDinput_name, const char *IDinmask_name, const char *IDoutput_name, const char *IDRM_name)
 Solve for response matrix given a series of input and output. More...
 

Variables

static long NBPARAM
 
static long double C0
 
static long double * polycoeff1 = NULL
 
static long double * polycoeff2 = NULL
 
static long dfcnt = 0
 
int fmInit = 0
 

Detailed Description

linear optimization tools

CPU-based lineal algebra tools: decomposition, SVD etc...

Function Documentation

◆ linopt_compute_linRM_from_inout()

imageID linopt_compute_linRM_from_inout ( const char *  IDinput_name,
const char *  IDinmask_name,
const char *  IDoutput_name,
const char *  IDRM_name 
)

Solve for response matrix given a series of input and output.

initial value of RM should be best guess inmask = 0 over input that are known to produce no response

◆ linopt_compute_SVDdecomp()

imageID linopt_compute_SVDdecomp ( const char *  IDin_name,
const char *  IDout_name,
const char *  IDcoeff_name 
)

Write rotation matrix to go from DM modes to eigenmodes

Compute SVD decomp

eigen mode index