Functions Documentation

CoReCon

These functions work on the whole module (e.g. filtering, etc.)

corecon.get(field)

Retrieve constraints for a single physical quantity (field) or single entry, depending on the structure of the string passed. If it is in the form ‘Field/DataEntry’, it will return a single DataEntry instance, if it’s in the form ‘Field’ it will return the entire Field class.

Parameters:

field (str.) – name of the physical parameter or constraints set to retrieve.

Returns:

A dictionary of constraints.

Return type:

dict (None if field is not available).

corecon.get_all_dicts()

Returns all constraints dictionaries.

Returns:

A list of all availabl dictionaries with constraints.

Return type:

list of dict.

corecon.get_data_entry_template()

Returns a string containing the data entry template for adding new constraints.

Returns:

a string containing the data entry template.

Return type:

str.

corecon.get_dataentry(field)

Retrieve constraints for a single constraints set (DataEntry).

Parameters:

field (str.) – name of the physical parameter to retrieve limits from, in the form ‘Field/DataEntry’

Returns:

A dictionary of constraints.

Return type:

dict (None if field is not available).

corecon.get_field(field)

Retrieve constraints for a single physical quantity (Field).

Parameters:

field (str.) – name of the physical parameter to retrieve limits from.

Returns:

A dictionary of constraints.

Return type:

dict (None if field is not available).

corecon.get_field_synonyms(field)

List all available synonyms for a field.

Parameters:

field (str.) – name of the physical parameter to retrieve the synonyms of.

Returns:

A list of physical quantities with available constraints.

Return type:

list of strings.

corecon.get_fields()

List all available fields, i.e. physical quantities with available constraints.

Returns:

A list of physical quantities with available constraints.

Return type:

list of strings.

corecon.print_all_entries()

Prints all entries available in corecon.

corecon.update_data()

Checks for updates in the available constraints (not of the package itself!) and downloads them if available. Requires internet connection to the CoReCon’s repository.

Field class

This class represents all constraints available concerning a single physical quantity. It is derived from python’s dictionary class, and provides additional field and data-manipulation functionalities.

class corecon.Field(*arg, **kw)

Class representing all constraints on a single physical quantity.

filter_by_extracted(extracted)

Filters the datapoint for a given parameter based on the value of their ‘extracted’ field.

Parameters:

extracted – value of the ‘extracted’ field

Returns:

A dictionary of constraints.

Return type:

dict.

filter_by_redshift_range(zmin, zmax)

Returns all the datapoint for a given parameter that lie in a redshift range zmin <= z < zmax.

Parameters:
  • zmin (float.) – lower edge of the redshift range.

  • zmax (float.) – upper edge of the redshift range.

Returns:

A dictionary of constraints.

Return type:

dict.

get_all_references()

Returns all references of the elements of this dict

Returns:

A list of references.

Return type:

list of string.

get_all_urls()

Returns all URLs of the elements of this dict

Returns:

A list of URLs.

Return type:

list of string.

get_lower_limits()

Returns all the lower limits for a given parameter as a dictionary.

Returns:

A dictionary of constraints.

Return type:

dict.

get_upper_limits()

Returns all the upper limits for a given parameter as a dictionary.

Returns:

A dictionary of constraints.

Return type:

dict.

DataEntry class

This class represents a single constraint (or set of) coming from a single source (usually a scientific publication).

class corecon.DataEntry(ndim=None, description=None, reference=None, parent_field=None, url=None, dimensions_descriptors=None, extracted=None, axes=None, values=None, err_up=None, err_down=None, upper_lim=None, lower_lim=None, extra_data=None)

Class representing a single constraint.

list_attributes()

List the attributes for the current entry.

nan_to_values(array, new_vals)

Replaces all NaN with values.

Parameters:
  • array ((list of) str) – (list of) variable name(s) to work on. Use ‘all’ to replace NaNs in all array variables.

  • new_vals (float or np.array) – value(s) to replace the NaNs with. If a np.array, it should have the correct dimension, i.e. the same as the number of NaNs.

set_lim_errors(newval, frac_of_values=False)

Set the value of error arrays for upper and lower limits.

Parameters:
  • newval (float) – value to assign to the error arrays.

  • frac_of_values (bool, optional) – if True, newval *= values.

swap_errors()

Swap upper and lower errors. Useful when computing a derived quantity.

swap_limits()

Swap upper and lower limits. Useful when computing a derived quantity.