phoebe_parameters

phoebe_parameters

Synopsis

enum                PHOEBE_parameter_kind;
                    PHOEBE_parameter_options;
                    PHOEBE_parameter_list;
                    PHOEBE_parameter_table;
                    PHOEBE_parameter_table_list;
extern              PHOEBE_parameter_table_list *PHOEBE_pt_list;
extern              PHOEBE_parameter_table *PHOEBE_pt;
PHOEBE_parameter_table* phoebe_parameter_table_new      ();
PHOEBE_parameter_table* phoebe_parameter_table_duplicate
                                                        (PHOEBE_parameter_table *table);
int                 phoebe_parameter_table_activate     (PHOEBE_parameter_table *table);
int                 phoebe_parameter_table_print        (PHOEBE_parameter_table *table);
int                 phoebe_parameter_table_free         (PHOEBE_parameter_table *table);
PHOEBE_parameter*   phoebe_parameter_new                ();
int                 phoebe_parameter_add                (char *qualifier,
                                                         char *description,
                                                         PHOEBE_parameter_kind kind,
                                                         char *dependency,
                                                         double min,
                                                         double max,
                                                         double step,
                                                         bool tba,
                                                         ...);
unsigned int        phoebe_parameter_hash               (char *qualifier);
PHOEBE_parameter*   phoebe_parameter_lookup             (char *qualifier);
int                 phoebe_parameter_commit             (PHOEBE_parameter *par);
int                 phoebe_parameter_add_option         (PHOEBE_parameter *par,
                                                         char *option);
int                 phoebe_parameter_update_deps        (PHOEBE_parameter *par,
                                                         int oldval);
int                 phoebe_parameter_free               (PHOEBE_parameter *par);
int                 phoebe_parameter_option_get_index   (PHOEBE_parameter *par,
                                                         char *option,
                                                         int *index);
bool                phoebe_parameter_option_is_valid    (char *qualifier,
                                                         char *option);
int                 phoebe_init_parameters              ();
int                 phoebe_free_parameters              ();
int                 phoebe_init_parameter_options       ();
int                 phoebe_qualifier_string_parse       (char *input,
                                                         char **qualifier,
                                                         int *index);
bool                phoebe_qualifier_is_constrained     (char *qualifier);
int                 phoebe_parameter_get_value          (PHOEBE_parameter *par,
                                                         ...);
int                 phoebe_parameter_set_value          (PHOEBE_parameter *par,
                                                         ...);
int                 phoebe_parameter_get_tba            (PHOEBE_parameter *par,
                                                         bool *tba);
int                 phoebe_parameter_set_tba            (PHOEBE_parameter *par,
                                                         bool tba);
int                 phoebe_parameter_get_step           (PHOEBE_parameter *par,
                                                         double *step);
int                 phoebe_parameter_set_step           (PHOEBE_parameter *par,
                                                         double step);
int                 phoebe_parameter_get_min            (PHOEBE_parameter *par,
                                                         double *valmin);
int                 phoebe_parameter_set_min            (PHOEBE_parameter *par,
                                                         double valmin);
int                 phoebe_parameter_get_max            (PHOEBE_parameter *par,
                                                         double *valmax);
int                 phoebe_parameter_set_max            (PHOEBE_parameter *par,
                                                         double valmax);
int                 phoebe_parameter_get_limits         (PHOEBE_parameter *par,
                                                         double *valmin,
                                                         double *valmax);
int                 phoebe_parameter_set_limits         (PHOEBE_parameter *par,
                                                         double valmin,
                                                         double valmax);
PHOEBE_parameter_list* phoebe_parameter_list_reverse    (PHOEBE_parameter_list *c,
                                                         PHOEBE_parameter_list *p);
PHOEBE_parameter_list* phoebe_parameter_list_get_marked_tba
                                                        ();
int                 phoebe_parameter_list_sort_marked_tba
                                                        (PHOEBE_parameter_list *list);
double              phoebe_spots_units_to_wd_conversion_factor
                                                        ();
enum                PHOEBE_el3_units;
int                 phoebe_el3_units_id                 (PHOEBE_el3_units *el3_units);
int                 phoebe_active_lcno_get              (int *active_lcno,
                                                         PHOEBE_array **active_lcindices);
int                 phoebe_active_rvno_get              (int *active_rvno,
                                                         PHOEBE_array **active_rvindices);
int                 phoebe_active_spots_get             (int *active_spots_no,
                                                         PHOEBE_array **active_spotindices);
int                 phoebe_open_parameter_file          (const char *filename);
int                 phoebe_open_legacy_parameter_file   (const char *filename);
int                 phoebe_save_parameter_file          (const char *filename);
int                 phoebe_restore_default_parameters   ();
int                 phoebe_parameter_file_import_bm3    (const char *bm3file,
                                                         const char *datafile);

Description

Details

enum PHOEBE_parameter_kind

typedef enum PHOEBE_parameter_kind {
	KIND_PARAMETER,
	KIND_MODIFIER,
	KIND_ADJUSTABLE,
	KIND_SWITCH,
	KIND_MENU,
	KIND_COMPUTED
} PHOEBE_parameter_kind;


PHOEBE_parameter_options

typedef struct {
	int                      optno;
	char                   **option;
} PHOEBE_parameter_options;


PHOEBE_parameter_list

typedef struct {
	struct PHOEBE_parameter *par;
	struct PHOEBE_parameter_list *next;
} PHOEBE_parameter_list;


PHOEBE_parameter_table

typedef struct {
	PHOEBE_parameter_list *bucket[PHOEBE_PT_HASH_BUCKETS];
	struct {
		PHOEBE_parameter_list *marked_tba;
		struct PHOEBE_ast_list *constraints;
	} lists;
} PHOEBE_parameter_table;


PHOEBE_parameter_table_list

typedef struct {
	PHOEBE_parameter_table *table;
	struct PHOEBE_parameter_table_list *next;
} PHOEBE_parameter_table_list;


PHOEBE_pt_list

extern PHOEBE_parameter_table_list *PHOEBE_pt_list;


PHOEBE_pt

extern PHOEBE_parameter_table *PHOEBE_pt;


phoebe_parameter_table_new ()

PHOEBE_parameter_table* phoebe_parameter_table_new      ();

Initializes a new parameter table and adds it to the list of all parameter tables.


phoebe_parameter_table_duplicate ()

PHOEBE_parameter_table* phoebe_parameter_table_duplicate
                                                        (PHOEBE_parameter_table *table);

Makes a duplicate copy of the table table.

table :

a PHOEBE_parameter_table to duplicate.

Returns :

PHOEBE_parameter_table.

phoebe_parameter_table_activate ()

int                 phoebe_parameter_table_activate     (PHOEBE_parameter_table *table);

Sets a pointer to the currently active parameter table PHOEBE_pt to table.

table :

parameter table that should be activated.

Returns :

PHOEBE_error_code.

phoebe_parameter_table_print ()

int                 phoebe_parameter_table_print        (PHOEBE_parameter_table *table);

table :

Returns :


phoebe_parameter_table_free ()

int                 phoebe_parameter_table_free         (PHOEBE_parameter_table *table);

Frees the parameter table table and removes it from the list of all parameter tables. Note that this does not free the parameters contained in the table; use phoebe_parameters_free() for that.

table :

a PHOEBE_parameter_table to be freed.

Returns :

PHOEBE_error_code.

phoebe_parameter_new ()

PHOEBE_parameter*   phoebe_parameter_new                ();

Returns :


phoebe_parameter_add ()

int                 phoebe_parameter_add                (char *qualifier,
                                                         char *description,
                                                         PHOEBE_parameter_kind kind,
                                                         char *dependency,
                                                         double min,
                                                         double max,
                                                         double step,
                                                         bool tba,
                                                         ...);

qualifier :

description :

kind :

dependency :

min :

max :

step :

tba :

... :

Returns :


phoebe_parameter_hash ()

unsigned int        phoebe_parameter_hash               (char *qualifier);

qualifier :

Returns :


phoebe_parameter_lookup ()

PHOEBE_parameter*   phoebe_parameter_lookup             (char *qualifier);

qualifier :

Returns :


phoebe_parameter_commit ()

int                 phoebe_parameter_commit             (PHOEBE_parameter *par);

par :

Returns :


phoebe_parameter_add_option ()

int                 phoebe_parameter_add_option         (PHOEBE_parameter *par,
                                                         char *option);

par :

option :

Returns :


phoebe_parameter_update_deps ()

int                 phoebe_parameter_update_deps        (PHOEBE_parameter *par,
                                                         int oldval);

par: PHOEBE_parameter that has been changed oldval: original value of the parameter par

Called whenever the dimension of parameter arrays must be changed. Typically this happens when the number of observed data curves changed, the number of spots is changed etc.

par :

oldval :

Returns :

PHOEBE_error_code.

phoebe_parameter_free ()

int                 phoebe_parameter_free               (PHOEBE_parameter *par);

par :

Returns :


phoebe_parameter_option_get_index ()

int                 phoebe_parameter_option_get_index   (PHOEBE_parameter *par,
                                                         char *option,
                                                         int *index);

Scans through all the options of the PHOEBE_parameter par and returns the index of the option. The par's kind must be KIND_MENU. If the option is not found, the index is set to -1 and ERROR_PARAMETER_OPTION_DOES_NOT_EXIST is returned.

par :

PHOEBE_parameter being queried

option :

the option to be looked up

index :

a pointer to the index to be assigned

Returns :

PHOEBE_error_code.

phoebe_parameter_option_is_valid ()

bool                phoebe_parameter_option_is_valid    (char *qualifier,
                                                         char *option);

qualifier :

option :

Returns :


phoebe_init_parameters ()

int                 phoebe_init_parameters              ();

Returns :


phoebe_free_parameters ()

int                 phoebe_free_parameters              ();

Frees all parameters from the currently active parameter table pointed to by a global variable PHOEBE_pt.

Returns :

PHOEBE_error_code.

phoebe_init_parameter_options ()

int                 phoebe_init_parameter_options       ();

Returns :


phoebe_qualifier_string_parse ()

int                 phoebe_qualifier_string_parse       (char *input,
                                                         char **qualifier,
                                                         int *index);

Parses the input string of the form qualifier[index]. The tokens are assigned to the passed arguments qualifier (which is allocated) and index. The allocated string needs to be freed by the calling function. Also, this function merely parses a passed string, it does not check for the qualifier and element validity. If the qualifier is a scalar, index is set to 0.

input :

the string of the form "qualifier[element]" to be parsed.

qualifier :

the newly allocated string that holds the qualifier.

index :

the qualifier index.

Returns :

PHOEBE_error_code.

phoebe_qualifier_is_constrained ()

bool                phoebe_qualifier_is_constrained     (char *qualifier);

This function checks whether a passed qualifier also appears in the list of constraints. If so, it returns true; else it returns false.

qualifier :

Returns :


phoebe_parameter_get_value ()

int                 phoebe_parameter_get_value          (PHOEBE_parameter *par,
                                                         ...);

Synopsis:

phoebe_parameter_get_value (par, [index, ], &value)

Assigns the value of the passed parameter par to the passed variable value. In case of strings pointers are returned, so you should never free the variable that has been assigned.

par :

PHOEBE_parameter to be queried

... :

index and a variable of the corresponding type in case of passband-dependent parameters, or a variable of the corresponding type in case of passband-independent parameters.

Returns :

PHOEBE_error_code

phoebe_parameter_set_value ()

int                 phoebe_parameter_set_value          (PHOEBE_parameter *par,
                                                         ...);

This is a public function for changing the value of the passed parameter par. The function also satisfies all constraints.

Synopsis:

phoebe_parameter_set_value (qualifier, [index, ] value)

par :

PHOEBE_parameter to be set.

... :

an optional curve index and an PHOEBE_value value.

Returns :

PHOEBE_error_code.

phoebe_parameter_get_tba ()

int                 phoebe_parameter_get_tba            (PHOEBE_parameter *par,
                                                         bool *tba);

par :

tba :

Returns :


phoebe_parameter_set_tba ()

int                 phoebe_parameter_set_tba            (PHOEBE_parameter *par,
                                                         bool tba);

par :

tba :

Returns :


phoebe_parameter_get_step ()

int                 phoebe_parameter_get_step           (PHOEBE_parameter *par,
                                                         double *step);

par :

step :

Returns :


phoebe_parameter_set_step ()

int                 phoebe_parameter_set_step           (PHOEBE_parameter *par,
                                                         double step);

par :

step :

Returns :


phoebe_parameter_get_min ()

int                 phoebe_parameter_get_min            (PHOEBE_parameter *par,
                                                         double *valmin);

par :

valmin :

Returns :


phoebe_parameter_set_min ()

int                 phoebe_parameter_set_min            (PHOEBE_parameter *par,
                                                         double valmin);

par :

valmin :

Returns :


phoebe_parameter_get_max ()

int                 phoebe_parameter_get_max            (PHOEBE_parameter *par,
                                                         double *valmax);

par :

valmax :

Returns :


phoebe_parameter_set_max ()

int                 phoebe_parameter_set_max            (PHOEBE_parameter *par,
                                                         double valmax);

par :

valmax :

Returns :


phoebe_parameter_get_limits ()

int                 phoebe_parameter_get_limits         (PHOEBE_parameter *par,
                                                         double *valmin,
                                                         double *valmax);

par :

valmin :

valmax :

Returns :


phoebe_parameter_set_limits ()

int                 phoebe_parameter_set_limits         (PHOEBE_parameter *par,
                                                         double valmin,
                                                         double valmax);

par :

valmin :

valmax :

Returns :


phoebe_parameter_list_reverse ()

PHOEBE_parameter_list* phoebe_parameter_list_reverse    (PHOEBE_parameter_list *c,
                                                         PHOEBE_parameter_list *p);

c :

p :

Returns :


phoebe_parameter_list_get_marked_tba ()

PHOEBE_parameter_list* phoebe_parameter_list_get_marked_tba
                                                        ();

Returns :


phoebe_parameter_list_sort_marked_tba ()

int                 phoebe_parameter_list_sort_marked_tba
                                                        (PHOEBE_parameter_list *list);

list :

Returns :


phoebe_spots_units_to_wd_conversion_factor ()

double              phoebe_spots_units_to_wd_conversion_factor
                                                        ();

Returns :


enum PHOEBE_el3_units

typedef enum PHOEBE_el3_units {
	PHOEBE_EL3_UNITS_TOTAL_LIGHT,
	PHOEBE_EL3_UNITS_FLUX,
	PHOEBE_EL3_UNITS_INVALID_ENTRY
} PHOEBE_el3_units;


phoebe_el3_units_id ()

int                 phoebe_el3_units_id                 (PHOEBE_el3_units *el3_units);

el3_units :

Returns :


phoebe_active_lcno_get ()

int                 phoebe_active_lcno_get              (int *active_lcno,
                                                         PHOEBE_array **active_lcindices);

Sweeps through all defined light curves and counts the ones that are active (i.e. their activity switch is set to 1). Active light curve indices are stored in the passed array active_lcindices. The array should not be initialized or allocated by the calling function, but it should be freed afrer use.

active_lcno :

placeholder for the number of active light curves.

active_lcindices :

placeholder for the array of active light curve indices

Returns :

PHOEBE_error_code.

phoebe_active_rvno_get ()

int                 phoebe_active_rvno_get              (int *active_rvno,
                                                         PHOEBE_array **active_rvindices);

Sweeps through all defined RV curves and counts the ones that are active (i.e. their activity switch is set to 1). Active RV curve indices are stored in the passed array active_rvindices. The array should not be initialized or allocated by the calling function, but it should be freed afrer use.

active_rvno :

placeholder for the number of active RV curves.

active_rvindices :

placeholder for the array of active RV curve indices

Returns :

PHOEBE_error_code.

phoebe_active_spots_get ()

int                 phoebe_active_spots_get             (int *active_spots_no,
                                                         PHOEBE_array **active_spotindices);

Sweeps through all defined spots and counts the ones that are active (i.e. their activity switch is set to 1). Active spot indices are stored in the passed array active_spots. The array should not be initialized or allocated by the calling function, but it should be freed afrer use.

active_spots_no :

placeholder for the number of active light spots.

active_spotindices :

Returns :

PHOEBE_error_code.

phoebe_open_parameter_file ()

int                 phoebe_open_parameter_file          (const char *filename);

filename :

Returns :


phoebe_open_legacy_parameter_file ()

int                 phoebe_open_legacy_parameter_file   (const char *filename);

Runs the lex converter on a legacy keyword file (i.e. a file pertaining to PHOEBE versions 0.2x), creates a parameter file in the temporary directory, opens it and removes it when done.

filename :

legacy (0.2x) keyword file

Returns :

PHOEBE_error_code.

phoebe_save_parameter_file ()

int                 phoebe_save_parameter_file          (const char *filename);

filename :

Returns :


phoebe_restore_default_parameters ()

int                 phoebe_restore_default_parameters   ();

Returns :


phoebe_parameter_file_import_bm3 ()

int                 phoebe_parameter_file_import_bm3    (const char *bm3file,
                                                         const char *datafile);

Imports Dave Bradstreet's Binary Maker 3 parameter file.

bm3file :

Binary Maker 3 (bm3) filename

datafile :

Observed curve filename

Returns :

PHOEBE_error_code.