00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef FORS_UTILS_H
00029 #define FORS_UTILS_H
00030
00031 #include <fors_setting.h>
00032 #include <fors_star.h>
00033
00034 #include <cpl.h>
00035
00042 #define assure(condition, action, ...) \
00043 do if (!(condition)) { \
00044 cpl_error_set_message(cpl_func, \
00045 cpl_error_get_code() ? \
00046 cpl_error_get_code() : \
00047 CPL_ERROR_UNSPECIFIED, \
00048 __VA_ARGS__); \
00049 cleanup; \
00050 action; \
00051 } while(0)
00052
00053
00063 #define passure(condition, action) \
00064 assure(condition, action, \
00065 "Internal error. Please report to %s", PACKAGE_BUGREPORT)
00066
00067 #define fors_msg(level, ...) fors_msg_macro(level, cpl_func, __VA_ARGS__)
00068
00069 #ifndef M_PI
00070 #define M_PI 3.1415926535897932384626433832795
00071 #endif
00072
00073 #ifndef M_E
00074 #define M_E 2.7182818284590452354
00075 #endif
00076
00077 #define TWOSQRT2LN2 2.35482004503095
00078
00079 extern const char *const fors_license;
00080 extern const double STDEV_PR_MAD;
00081
00082 int fors_get_version_binary(void);
00083 double fors_rand_gauss(void);
00084
00085 double fors_tools_get_kth_double(double *a, int n, int k);
00086 float fors_tools_get_kth_float(float *a, int n, int k);
00087 float fors_tools_get_median_float( float *a, int n);
00088 float fors_tools_get_median_fast_float(float *a, int n) ;
00089 double fors_utils_median_corr(int n);
00090
00091 void fors_frameset_print(const cpl_frameset *frames);
00092 void fors_frame_print(const cpl_frame *f);
00093 const char *fors_frame_get_type_string(const cpl_frame *f);
00094 const char *fors_frame_get_group_string(const cpl_frame *f);
00095 const char *fors_frame_get_level_string(const cpl_frame *f);
00096 cpl_frameset *fors_frameset_extract(const cpl_frameset *frames,
00097 const char *tag);
00098 const char *fors_type_get_string(cpl_type type);
00099 void fors_parameterlist_set_defaults(cpl_parameterlist *parlist);
00100
00101 #ifdef CPL_IS_NOT_CRAP
00102 #else
00103 cpl_image *fors_imagelist_collapse_create(const cpl_imagelist *ilist);
00104 cpl_image *fors_imagelist_collapse_median_create(const cpl_imagelist *ilist);
00105 #endif
00106
00107 double fors_angle_diff(const double *a1, const double *a2);
00108
00109 void fors_msg_macro(cpl_msg_severity level, const char *fct, const char *format, ...)
00110 #ifdef __GNUC__
00111 __attribute__((format (printf, 3, 4)))
00112 #endif
00113 ;
00114 #endif