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,
                                                         char *format,
                                                         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_parameters_check_bounds      (char **offender);
bool                phoebe_is_qualifier                 (char *qualifier);
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);
bool                phoebe_parameter_is_within_limits   (PHOEBE_parameter *par);
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);
PHOEBE_array*       phoebe_active_curves_get            (PHOEBE_curve_type type);
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                ();

Allocates memory for the new parameter and NULLifies all field pointers for subsequent allocation.

Returns :

pointer to the newly allocated PHOEBE_parameter.

phoebe_parameter_add ()

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

This function is a wrapper that facilitates the installment of new parameters. Each parameter is refered to by its qualifier; make sure you follow the specifications on qualifier naming conventions. The description should be in a human-readable form, concise yet informative. Parameter kind is one of KIND_PARAMETER, KIND_MODIFIER, KIND_ADJUSTABLE, KIND_SWITCH, KIND_MENU, and KIND_COMPUTED. Parameter dependency is a pointer to a KIND_MODIFIER parameter that determines the sizing of the array of the newly installed parameter. For example, light curve dependent parameters such as passband luminosities depend on the number of light curves, so for those parameters the dependency would be a pointer to phoebe_hla parameter. Argument format determines the way values are stored (and rendered); it fully conforms to the C printf/scanf formatting rules. Values min, max and step determine the adjustment properties for KIND_ADJUSTABLE parameters, and are dummy numbers for all other kinds of parameters. The tba switch can be either TRUE (1) or FALSE (0); it determines whether the parameter is adjustable or not; it does not influence whether the parameter is actually marked for adjustment -- only whether it can be marked for adjustment. The last argument to the function is the default value; it has to be of the appropriate type for the installed parameter.

qualifier :

new qualifer to be registered

description :

parameter description (human-readable)

kind :

parameter kind

dependency :

dependency on dimensioning parameters

format :

format string for the value rendering

min :

minimum allowed value

max :

maximum allowed value

step :

adjustment step

tba :

to-be-adjusted bit

... :

default value of the suitable type

Returns :

PHOEBE_error_code.

phoebe_parameter_hash ()

unsigned int        phoebe_parameter_hash               (char *qualifier);

qualifier :

Returns :


phoebe_parameter_lookup ()

PHOEBE_parameter*   phoebe_parameter_lookup             (char *qualifier);

Looks up qualifier in the global table of parameters. If the qualifier is not found, a warning is issued and NULL is returned. The function returns a pointer to the global parameter table and the calling function should thus never free it.

qualifier :

parameter qualifier

Returns :

a pointer to PHOEBE_parameter if qualifier is found, NULL otherwise.

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              ();

This (and only this) function declares parameters that are used in PHOEBE; there is no GUI connection or any other plug-in connection in this function, only native PHOEBE parameters. PHOEBE drivers, such as the scripter or the GUI, should implement their own initialization function.

Returns :

PHOEBE_error_code.

phoebe_free_parameters ()

int                 phoebe_free_parameters              ();

Frees all parameters from the currently active parameter table pointed to by a global variable PHOEBE_pt. This function is called upon exit from PHOEBE by phoebe_quit(), it should not be used directly.

Returns :

PHOEBE_error_code.

phoebe_init_parameter_options ()

int                 phoebe_init_parameter_options       ();

This function adds options to all KIND_MENU parameters. In principle all calls to phoebe_parameter_add_option() function should be checked for return value, but since the function issues a warning in case a qualifier does not contain a menu, it is not strictly necessary.

Returns :

PHOEBE_error_code.

phoebe_parameters_check_bounds ()

int                 phoebe_parameters_check_bounds      (char **offender);

Checks whether all KIND_ADJUSTABLE parameter values are within their respective bounds (limits). If an out-of-bounds situation is encountered, offender is set to point to the qualifier in question to facilitate error handling from the calling function. If all parameters are within their respective bounds, offender is set to NULL.

The contents of offender must not be freed as they point to the entry in the parameter table.

offender :

placeholder for the qualifier that is out of bounds

Returns :

PHOEBE_error_code.

phoebe_is_qualifier ()

bool                phoebe_is_qualifier                 (char *qualifier);

Checks whether the passed string qualifier is a valid qualifier.

qualifier :

string to be checked if it is a valid qualifier

Returns :

TRUE if qualifier is valid; FALSE otherwise.

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);

Checks whether a passed qualifier also appears in the list of constraints. For passband luminosities and gamma velocity, this function checks for embedded constraints, i.e. whether automatic computation switch is on.

qualifier :

parameter to be checked for constraints.

Returns :

TRUE if qualifier is constrained; FALSE otherwise.

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_is_within_limits ()

bool                phoebe_parameter_is_within_limits   (PHOEBE_parameter *par);

Checks if the parameter value is within the defined limits. For passband-dependent parameters all components are checked.

par :

parameter the value of which should be checked

Returns :

TRUE if the value is within limits, FALSE otherwise.

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_curves_get ()

PHOEBE_array*       phoebe_active_curves_get            (PHOEBE_curve_type type);

Sweeps through all defined light or RV curves (depending on type) and counts the ones that are active (i.e. their phoebe_*_active parameter is set to 1).

type :

curve type (LC or RV)

Returns :

an array of active curve indices, or NULL in case of failure.

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.