![]() |
![]() |
![]() |
PHOEBE Reference Manual | ![]() |
---|---|---|---|---|
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);
typedef enum PHOEBE_parameter_kind { KIND_PARAMETER, KIND_MODIFIER, KIND_ADJUSTABLE, KIND_SWITCH, KIND_MENU, KIND_COMPUTED } PHOEBE_parameter_kind;
typedef struct { struct PHOEBE_parameter *par; struct PHOEBE_parameter_list *next; } PHOEBE_parameter_list;
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;
typedef struct { PHOEBE_parameter_table *table; struct PHOEBE_parameter_table_list *next; } PHOEBE_parameter_table_list;
PHOEBE_parameter_table* phoebe_parameter_table_new ();
Initializes a new parameter table and adds it to the list of all parameter tables.
Returns : |
PHOEBE_parameter_table. |
PHOEBE_parameter_table* phoebe_parameter_table_duplicate (PHOEBE_parameter_table *table);
Makes a duplicate copy of the table table
.
|
a PHOEBE_parameter_table to duplicate. |
Returns : |
PHOEBE_parameter_table. |
int phoebe_parameter_table_activate (PHOEBE_parameter_table *table);
Sets a pointer to the currently active parameter table PHOEBE_pt
to
table
.
|
parameter table that should be activated. |
Returns : |
PHOEBE_error_code. |
int phoebe_parameter_table_print (PHOEBE_parameter_table *table);
|
|
Returns : |
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.
|
a PHOEBE_parameter_table to be freed. |
Returns : |
PHOEBE_error_code. |
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. |
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.
|
new qualifer to be registered |
|
parameter description (human-readable) |
|
parameter kind |
|
dependency on dimensioning parameters |
|
format string for the value rendering |
|
minimum allowed value |
|
maximum allowed value |
|
adjustment step |
|
to-be-adjusted bit |
|
default value of the suitable type |
Returns : |
PHOEBE_error_code. |
unsigned int phoebe_parameter_hash (char *qualifier);
|
|
Returns : |
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.
|
parameter qualifier |
Returns : |
a pointer to PHOEBE_parameter if qualifier is found,
NULL otherwise.
|
int phoebe_parameter_add_option (PHOEBE_parameter *par, char *option);
|
|
|
|
Returns : |
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.
|
|
|
|
Returns : |
PHOEBE_error_code. |
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.
|
PHOEBE_parameter being queried |
|
the option to be looked up |
|
a pointer to the index to be assigned |
Returns : |
PHOEBE_error_code. |
bool phoebe_parameter_option_is_valid (char *qualifier, char *option);
|
|
|
|
Returns : |
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. |
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. |
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. |
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.
|
placeholder for the qualifier that is out of bounds |
Returns : |
PHOEBE_error_code. |
bool phoebe_is_qualifier (char *qualifier);
Checks whether the passed string qualifier
is a valid qualifier.
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.
|
the string of the form "qualifier[element]" to be parsed. |
|
the newly allocated string that holds the qualifier. |
|
the qualifier index. |
Returns : |
PHOEBE_error_code. |
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.
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.
|
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 |
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)
|
PHOEBE_parameter to be set. |
|
an optional curve index and an PHOEBE_value value. |
Returns : |
PHOEBE_error_code. |
int phoebe_parameter_get_tba (PHOEBE_parameter *par, bool *tba);
|
|
|
|
Returns : |
int phoebe_parameter_set_tba (PHOEBE_parameter *par, bool tba);
|
|
|
|
Returns : |
int phoebe_parameter_get_step (PHOEBE_parameter *par, double *step);
|
|
|
|
Returns : |
int phoebe_parameter_set_step (PHOEBE_parameter *par, double step);
|
|
|
|
Returns : |
int phoebe_parameter_get_min (PHOEBE_parameter *par, double *valmin);
|
|
|
|
Returns : |
int phoebe_parameter_set_min (PHOEBE_parameter *par, double valmin);
|
|
|
|
Returns : |
int phoebe_parameter_get_max (PHOEBE_parameter *par, double *valmax);
|
|
|
|
Returns : |
int phoebe_parameter_set_max (PHOEBE_parameter *par, double valmax);
|
|
|
|
Returns : |
int phoebe_parameter_get_limits (PHOEBE_parameter *par, double *valmin, double *valmax);
|
|
|
|
|
|
Returns : |
int phoebe_parameter_set_limits (PHOEBE_parameter *par, double valmin, double valmax);
|
|
|
|
|
|
Returns : |
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.
PHOEBE_parameter_list* phoebe_parameter_list_reverse (PHOEBE_parameter_list *c, PHOEBE_parameter_list *p);
|
|
|
|
Returns : |
PHOEBE_parameter_list* phoebe_parameter_list_get_marked_tba ();
Returns : |
int phoebe_parameter_list_sort_marked_tba (PHOEBE_parameter_list *list);
|
|
Returns : |
double phoebe_spots_units_to_wd_conversion_factor ();
Returns : |
typedef enum PHOEBE_el3_units { PHOEBE_EL3_UNITS_TOTAL_LIGHT, PHOEBE_EL3_UNITS_FLUX, PHOEBE_EL3_UNITS_INVALID_ENTRY } PHOEBE_el3_units;
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).
|
curve type (LC or RV) |
Returns : |
an array of active curve indices, or NULL in case of failure. |
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.
|
placeholder for the number of active light spots. |
|
|
Returns : |
PHOEBE_error_code. |
int phoebe_open_parameter_file (const char *filename);
|
|
Returns : |
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.
|
legacy (0.2x) keyword file |
Returns : |
PHOEBE_error_code. |
int phoebe_save_parameter_file (const char *filename);
|
|
Returns : |
int phoebe_parameter_file_import_bm3 (const char *bm3file, const char *datafile);
Imports Dave Bradstreet's Binary Maker 3 parameter file.
|
Binary Maker 3 (bm3) filename |
|
Observed curve filename |
Returns : |
PHOEBE_error_code. |