astrohack.utils.text ==================== .. py:module:: astrohack.utils.text Attributes ---------- .. autoapisummary:: astrohack.utils.text.lnbr astrohack.utils.text.spc Functions --------- .. autoapisummary:: astrohack.utils.text.tuple_inspect astrohack.utils.text.approve_prefix astrohack.utils.text.add_prefix astrohack.utils.text.param_to_list astrohack.utils.text.get_default_file_name astrohack.utils.text.get_data_content_string astrohack.utils.text.print_dict_types astrohack.utils.text.get_property_string astrohack.utils.text.rad_to_hour_str astrohack.utils.text.rad_to_deg_str astrohack.utils.text.get_summary_header astrohack.utils.text.get_method_list_string astrohack.utils.text.format_frequency astrohack.utils.text.format_wavelength astrohack.utils.text.format_duration astrohack.utils.text.format_angular_distance astrohack.utils.text.format_label astrohack.utils.text.format_value_unit astrohack.utils.text.format_value_error astrohack.utils.text.fixed_format_error astrohack.utils.text.bool_to_str astrohack.utils.text.string_to_ascii_file astrohack.utils.text.create_pretty_table astrohack.utils.text.create_dataset_label astrohack.utils.text.get_data_name astrohack.utils.text.significant_figures_round astrohack.utils.text.statistics_to_text astrohack.utils.text.dynamic_format astrohack.utils.text.format_az_el_information astrohack.utils.text.format_general_information astrohack.utils.text.format_spectral_information astrohack.utils.text.format_beam_information astrohack.utils.text.format_aperture_information astrohack.utils.text.format_observation_summary astrohack.utils.text.make_header Module Contents --------------- .. py:data:: lnbr :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ """ .. raw:: html
.. py:data:: spc :value: ' ' .. py:function:: tuple_inspect(param_tuple) .. py:function:: approve_prefix(key) .. py:function:: add_prefix(input_string, prefix) 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 .. py:function:: param_to_list(param, data_dict, prefix) 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 .. py:function:: get_default_file_name(input_filename: str, output_ext: str, user_filename: str | None) -> str .. py:function:: get_data_content_string(data_object, alignment='l', field_names=None) 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 .. py:function:: print_dict_types(le_dict, ident=4, show_values=False) .. py:function:: get_property_string(root_attrs, split_key=None, alignment='l', heading='Input Parameters') .. py:function:: rad_to_hour_str(rad) Converts an angle in radians to hours minutes and seconds :param rad: angle in radians Returns: xxhyymzz.zzzs .. py:function:: rad_to_deg_str(rad) Converts an angle in radians to degrees minutes and seconds :param rad: angle in radians Returns: xx°yymzz.zzzs .. py:function:: get_summary_header(filename, print_len=80, frame_char='#', frame_width=3) 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 .. py:function:: get_method_list_string(astrohack_obj, alignment='l', print_len=80) Print the method list of a mds object .. py:function:: format_frequency(freq_value, unit='Hz', decimal_places=4) .. py:function:: format_wavelength(user_value, unit='m', decimal_places=2) .. py:function:: format_duration(duration, unit='sec', decimal_places=2) .. py:function:: format_angular_distance(user_value, unit='rad', decimal_places=2) .. py:function:: format_label(label, separators=('_', '\n'), new_separator=' ') .. py:function:: format_value_unit(value, unit, decimal_places=2) .. py:function:: format_value_error(value, error, scaling, tolerance) Format values based and errors based on the significant digits .. py:function:: fixed_format_error(value, error, scaling, significance_scale) 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 .. py:function:: bool_to_str(boolean) .. py:function:: string_to_ascii_file(string, filename) .. py:function:: create_pretty_table(field_names, alignment='c') .. py:function:: create_dataset_label(ant_id, ddi_id, separator=':') .. py:function:: get_data_name(data_id) .. py:function:: significant_figures_round(x, digits) .. py:function:: statistics_to_text(data_statistics: dict, keys: list = None, num_format: str = None) .. py:function:: dynamic_format(value) .. py:function:: format_az_el_information(az_el_dict, key='center', unit='deg', precision='.1f') .. py:function:: 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') .. py:function:: format_spectral_information(freq_dict, tab, ident, key_size) .. py:function:: format_beam_information(beam_dict, tab, ident, key_size) .. py:function:: format_aperture_information(aperture_dict, tab, ident, key_size) .. py:function:: format_observation_summary(obs_sum, tab_size=3, tab_count=0, az_el_key='mean', phase_center_unit='radec', az_el_unit='deg', time_format='%d %h %Y, %H:%M:%S', precision='.1f', key_size=18) .. py:function:: make_header(heading, separator, header_width, buffer_width)