iode.Equations
- class iode.Equations(filepath: str = None)[source]
IODE Equations database.
- Parameters:
- filepath: str, optional
file containing the IODE equations to load.
- Attributes:
- filename: str
- description: str
Methods
clear()Delete all objects from the current database.
compare(filepath[, ...])The objects of the current database are compared with those stored in the file filepath.
copy([pattern])Create a new database instance in which each object is a copy of the original object from the global IODE database.
copy_from(input_files[, names])Copy (a subset of) equations from the input file(s) 'input_files' into the current database.
estimate([from_period, to_period, list_eqs, ...])Estimate an equation or a block of equations.
estimate_step_wise(eq_names[, from_period, ...])Estimates (an) equation(s) and searches for the best possible test values for all possible combinations of coefficients.
from_frame(df)Copy the pandas DataFrame df into the IODE Equations database.
from_series(s)Copy the pandas Series s into the IODE Equations database.
get_lec(key)Get the LEC of an equation in the database.
get_name(pos)Return the name of the IODE object at position pos in the database.
get_names([pattern, filepath])Returns the list of objects names given a pattern.
get_names_from_pattern(list_name, pattern, xdim)Generate an IODE list containing the names of objects that match a given pattern.
index(name)Return the position of the IODE object with name name in the database.
load(filepath)Load objects stored in file 'filepath' into the current database.
merge(other[, overwrite])Merge the content of the 'other' database into the current database.
merge_from(input_file)Merge all objects stored in the input file 'input_file' into the current database.
Create a new empty detached database.
print_to_file(filepath[, names, format])Print the list equations defined by names to the file filepath using the format format.
remove(names)Delete the object(s) named 'names' from the current database.
rename(old_name, new_name[, overwrite])Rename an object of the database.
save(filepath[, compress])Save objects of the current database into the file 'filepath'.
search(pattern[, word, case_sensitive, ...])Return a list of all objects from the current database having a specific pattern in their names or LEC expression, comment...
subset(pattern, copy)Create a subset of the database filtered by a name pattern.
to_frame()Create a pandas DataFrame from the current Equations database.
from_cython_obj
get_instance
- Returns:
- Equations
Examples
>>> from iode import equations, SAMPLE_DATA_DIR >>> equations.load(f"{SAMPLE_DATA_DIR}/fun.eqs") Loading .../fun.eqs 274 objects loaded >>> len(equations) 274 >>> equations Workspace: Equations nb equations: 274 filename: ...\tests\data\fun.eqs name lec method sample block fstat r2adj dw loglik date ACAF (ACAF/VAF[-1]) :=acaf1+acaf2*GOSF[-1]+ acaf4*(TIME=1995) LSQ 1980Y1:1996Y1 ACAF 32.2732 0.7963 2.3293 83.8075 12-06-1998 ACAG ACAG := ACAG[-1]+r VBBP[-1]+(0.006*VBBP[-1]*(TIME=2001)-0.008*(TIME=2008)) LSQ None ACAG 0.0000 0.0000 0.0000 0.0000 AOUC AOUC:=((WCRH/QL)/(WCRH/QL)[1990Y1])*(VAFF/(VM+VAFF))[-1]+PM*(VM/(VAFF+VM))[-1] LSQ None AOUC 0.0000 0.0000 0.0000 0.0000 BENEF d BENEF :=d(VBNP-(IT+ITCEE)+SUB-DPUU-(WCF+SSFFIC+WDOM+WBG+ YN)-(GOSH-DPUH+IDH)-DTF-RIDGG+YIDG) LSQ None BENEF 0.0000 0.0000 0.0000 0.0000 BQY BQY:=(YK+YN)/PBBP LSQ None BQY 0.0000 0.0000 0.0000 0.0000 ... ... ... ... ... ... ... ... ... ... YSSF dln YSSF:=dln WBF_ LSQ None YSSF 0.0000 0.0000 0.0000 0.0000 YSSG YSSG := SSF+SSH-(YSSF+COTRES) LSQ None YSSG 0.0000 0.0000 0.0000 0.0000 ZF grt ZF :=grt PC+ZX-0.05*grt PME LSQ None ZF 0.0000 0.0000 0.0000 0.0000 ZJ grt ZJ :=grt PC +ZX-0.05*grt PME LSQ None ZJ 0.0000 0.0000 0.0000 0.0000 ZZF_ ZZF_ := ZZF_[-1] LSQ None ZZF_ 0.0000 0.0000 0.0000 0.0000
Methods
__init__([filepath])clear()Delete all objects from the current database.
compare(filepath[, ...])The objects of the current database are compared with those stored in the file filepath.
copy([pattern])Create a new database instance in which each object is a copy of the original object from the global IODE database.
copy_from(input_files[, names])Copy (a subset of) equations from the input file(s) 'input_files' into the current database.
estimate([from_period, to_period, list_eqs, ...])Estimate an equation or a block of equations.
estimate_step_wise(eq_names[, from_period, ...])Estimates (an) equation(s) and searches for the best possible test values for all possible combinations of coefficients.
from_cython_obj(obj)from_frame(df)Copy the pandas DataFrame df into the IODE Equations database.
from_series(s)Copy the pandas Series s into the IODE Equations database.
get_instance()get_lec(key)Get the LEC of an equation in the database.
get_name(pos)Return the name of the IODE object at position pos in the database.
get_names([pattern, filepath])Returns the list of objects names given a pattern.
get_names_from_pattern(list_name, pattern, xdim)Generate an IODE list containing the names of objects that match a given pattern.
index(name)Return the position of the IODE object with name name in the database.
load(filepath)Load objects stored in file 'filepath' into the current database.
merge(other[, overwrite])Merge the content of the 'other' database into the current database.
merge_from(input_file)Merge all objects stored in the input file 'input_file' into the current database.
Create a new empty detached database.
print_to_file(filepath[, names, format])Print the list equations defined by names to the file filepath using the format format.
remove(names)Delete the object(s) named 'names' from the current database.
rename(old_name, new_name[, overwrite])Rename an object of the database.
save(filepath[, compress])Save objects of the current database into the file 'filepath'.
search(pattern[, word, case_sensitive, ...])Return a list of all objects from the current database having a specific pattern in their names or LEC expression, comment...
subset(pattern, copy)Create a subset of the database filtered by a name pattern.
to_frame()Create a pandas DataFrame from the current Equations database.
Attributes
Return the list of coefficients (scalars) used in the equations of (the subset of) the database.
Description of the current database.
Create a pandas DataFrame from the current Equations database.
Return the filepath associated with the current database.
Allow to select the ith equation in the database.
Return the object type of the current database.
Whether or not any change made on the present database or subset will modify the global IODE workspace.
Whether or not the present database represents the global IODE workspace.
List of names of all objects in the current database.
Whether to print only the LEC formula, or the LEC formula and the comment, or the LEC formula, the comment and the estimation results of the IODE equations in the current database.
Whether to print the LEC formula of each equation:
Number of decimals to print.
Return the list of variables used in the equations of (the subset of) the database.