1 #include <gsl/gsl_rng.h> 2 #include <gsl/gsl_randist.h> 8 #include "../csm/csm_all.h" 10 void purify(
LDP ld,
double threshold_min,
double threshold_max);
20 int main(
int argc,
const char * argv[]) {
24 options_banner(
"ld_purify: Makes sure that the file format is valid. \n * Sets valid=0 if reading is outside interval ");
30 "Sets valid=0 if readings are less than this threshold.");
32 "Sets valid=0 if readings are more than this threshold.");
51 LDP ld;
int count = -1;
57 sm_error(
"Wait, we didn't purify enough (#%d in file)\n", count);
71 for(
int i=0;i<ld->
nrays;i++) {
72 if(!ld->
valid[i])
continue;
75 if(
is_nan(rho) | (rho < threshold_min) | (rho > threshold_max) ) {
78 ld->
alpha[i] = GSL_NAN;
void options_banner(const char *message)
void sm_set_program_name(const char *name)
void ld_write_as_json(LDP ld, FILE *stream)
void options_double(struct option *, const char *name, double *p, double def_value, const char *desc)
int ld_valid_fields(LDP ld)
FILE * open_file_for_writing(const char *filename)
double *restrict readings
struct option * options_allocate(int n)
LDP ld_from_json_stream(FILE *file)
int *restrict alpha_valid
void purify(LDP ld, double threshold_min, double threshold_max)
FILE * open_file_for_reading(const char *filename)
int main(int argc, const char *argv[])
void options_print_help(struct option *options, FILE *f)
void options_string(struct option *, const char *name, const char **p, const char *def_balue, const char *desc)
void sm_error(const char *msg,...)
int options_parse_args(struct option *ops, int argc, const char *argv[])