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 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, optional
A list of targets. If no night plan is given, this list and the calibrators must be given.
- calibratorslist, optional
A list of calibrators that must be given with the targets.
- orderslist, optional
A list of the orders of the calibrators. If not given, it will be assumed that the calibrators are before the targets.
- tagslist, 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.