astrohack.utils.text
Attributes
Functions
|
|
|
|
|
Adds a prefix to a string filename, if the filename is a path with /, adds the prefix to the actual filename at the |
|
Transforms a string parameter to a list if parameter is all or a single string |
|
|
|
Factorized printing of the prettytable with the data contents |
|
|
|
|
|
Converts an angle in radians to hours minutes and seconds |
|
Converts an angle in radians to degrees minutes and seconds |
|
Print a summary header dynamically adjusted to the filename |
|
Print the method list of a mds object |
|
|
|
|
|
|
|
|
|
|
|
|
|
Format values based and errors based on the significant digits |
|
Format value and error based on a significance scale |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Module Contents
- add_prefix(input_string, prefix)[source]
Adds a prefix to a string filename, if the filename is a path with /, adds the prefix to the actual filename at the end of the path :param input_string: filename or file path :param prefix: prefix to be added to the filename
Returns: filename or path plus prefix added to the filename
- param_to_list(param, data_dict, prefix)[source]
Transforms a string parameter to a list if parameter is all or a single string :param param: string or list parameter :param data_dict: Dictionary in which to search for data to be listed :param prefix: prefix to be added to parameter
Returns: parameter converted to a list
- get_data_content_string(data_object, alignment='l', field_names=None)[source]
Factorized printing of the prettytable with the data contents :param data_object: Dictionary with data to be displayed :param field_names: Field names in the table :param alignment: Contents of the table to be aligned Left or Right
- rad_to_hour_str(rad)[source]
Converts an angle in radians to hours minutes and seconds :param rad: angle in radians
Returns: xxhyymzz.zzzs
- rad_to_deg_str(rad)[source]
Converts an angle in radians to degrees minutes and seconds :param rad: angle in radians
Returns: xx°yymzz.zzzs
- get_summary_header(filename, print_len=80, frame_char='#', frame_width=3)[source]
Print a summary header dynamically adjusted to the filename :param filename: filename :param print_len: Length of the print on screen :param frame_char: Character to frame header :param frame_width: Width of the frame
- Returns:
header string
- get_method_list_string(astrohack_obj, alignment='l', print_len=80)[source]
Print the method list of a mds object
- format_value_error(value, error, scaling, tolerance)[source]
Format values based and errors based on the significant digits
- fixed_format_error(value, error, scaling, significance_scale)[source]
Format value and error based on a significance scale :param value: value to be formatted :param error: error to be formatted :param scaling: scaling to be applied to value and error :param significance_scale: scale for which signifcant values are expected
- Returns:
formatted string with value +- error
- format_general_information(obs_dict, tab, ident, key_size, az_el_key='mean', phase_center_unit='radec', az_el_unit='deg', time_format='%d %h %Y, %H:%M:%S', precision='.1f')[source]