p2obt.backend.utils#
- p2obt.backend.utils.add_space(input_str: str) str[source]#
Adds a space to the “HD xxxxxx” targets, between the HD and the rest.
- p2obt.backend.utils.contains_element(list_to_search: list, element_to_search: str) bool[source]#
Checks if an element is in the list searched and returns True or False
- Parameters:
list_to_search (list) – The list to be searched in.
element_to_search (str) – The element being searched for.
- Returns:
element_in_list – True if element is found, False otherwise.
- Return type:
bool
- p2obt.backend.utils.convert_proper_motions(*proper_motions: Unit('mas'), rfloat: bool | None = True) tuple[source]#
Converts the proper motions from (mas/yr) to (arcsec/yr).
Input is assumed to be in (mas), if given as a float.
- p2obt.backend.utils.create_night_plan_dict(targets: list[str] | None = None, calibrators: list[list[str] | str] | None = None, orders: dict[str, str] | list[str] | str | None = None, tags: dict[str, str] | list[str] | str | None = None, resolution: dict[str, str] | list[str] | str | None = None, configuration: dict[str, str] | list[str] | str | None = None, modes: dict[str, str] | list[str] | str | None = None)[source]#
Creates a night plan dictionary for the observations.
- targetslist of str, optional
A list of targets. If no night plan is given, this list and the calibrators must be given.
- calibratorslist of list of str or list of str, optional
A list of calibrators that must be given with the targets.
- orderslist of str or str, optional
A list of the orders of the calibrators. If not given, it will be assumed that the calibrators are before the targets.
- tagslist of str or str, optional
A list of the tags of the calibrators. If not given, it will be “LN” for all calibrators.
- resolutiondict or list of str or str, optional
A dictionary containing the resolution for each target or a list of resolutions for all targets or a single resolution for all targets. Will only be used if no night plan is given.
- configurationsdict or list of str or str, optional
A dictionary containing the array configuration for each target or a list of array configurations for all targets or a single array configuration for all targets. Will only be used if no night plan is given.
- modesdict or list of str or str, optional
A dictionary containing the operational mode for each target or a list of operational modes for all targets or a single operational mode for all targets. Will only be used if no night plan is given.
- p2obt.backend.utils.prompt_user(message: str, selections: list[str]) str[source]#
Prompts the user for a numerical input and returns the associated value from the selection list.
- Parameters:
message (str)
selections (list of str)
- Returns:
user_input
- Return type:
str
- p2obt.backend.utils.remove_parenthesis(input_str: str) str[source]#
Removes parenthesis from a string.
This if for the ob’s name so it is elegible for upload (either manually after (.obx)-file creation or automatically.