From d985b82d22274d670819377f75108d1074ad83d0 Mon Sep 17 00:00:00 2001 From: Yael-II <154762804+Yael-II@users.noreply.github.com> Date: Thu, 28 Nov 2024 23:29:53 +0100 Subject: [PATCH] added manual input --- README.md | 1 + Source/astrobs_v1_toolbox.py | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22b3904..fff9c65 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ add an object from simbad search a region centred on the ra/dec coordinates, with a given radius (coordinates should be expressed as `12h30m30s`, `90d30m30s` or `90.555d`) +- `manual [name] -s [seq]`, `add [name] -s [seq]`: manually add a target (only the name and the sequence are available for now) - `sidereal`, `st`: computes the sidereal time for each target - `sequence`, `seq`: computes the sequence order for each target diff --git a/Source/astrobs_v1_toolbox.py b/Source/astrobs_v1_toolbox.py index ed71f23..69e6699 100644 --- a/Source/astrobs_v1_toolbox.py +++ b/Source/astrobs_v1_toolbox.py @@ -22,6 +22,7 @@ READ = ["READ", "OPEN"] CALIB = ["CALIB", "CALIBRATION"] SIMBAD = ["SIMBAD", "OBJECT"] REGION = ["SEARCH", "REGION"] +MANUAL = ["MANUAL", "ADD"] ST = ["SIDEREAL", "ST"] SEQ = ["SEQUENCE", "SEQ"] CHECK = ["CHECK"] @@ -721,6 +722,10 @@ def print_help(): "search a region centred on the ra/dec coordinates, " "with a given radius (coordinates should be expressed as " "12h30m30s, 90d30m30s or 90.555d)\n" + "\t- manual [name] [seq (optional)], " + "add [name] [seq (optional)]: " + "manually add a target (only the name the sequence are " + "available for now)\n" "\t- sidereal, st: computes the sidereal time for each target\n" "\t- sequence, seq: computes the sequence order for each " "target\n" @@ -731,7 +736,7 @@ def print_help(): "\t- yes, y, 1: yes\n" "\t- no, n, 0, or anything else: no\n" "\t- all, *: select all\n" - "\t- done, ok: confirm, save the current state and quit" + "\t- done, ok: confirm, save the current state and quit\n" "\n" "[1] Pr. Dumbledore, Albus Percival Wulfric Brian, 1992, Hogwarts School of Witchcraft and Wizardry" "\033[0m") @@ -741,7 +746,8 @@ def resolve_input(text: str, table: Table, config: dict): """ - Resolve the input to execute the expected function in an interactive way + Resolve the input to execute the expected function in an + interactive way @params: - text: the input string entered by the user - table: the table of targets @@ -771,6 +777,18 @@ def resolve_input(text: str, obj = Simbad.query_region(region, radius) swap_table = add_simbad(swap_table, obj, config) select_obj(table, swap_table, config) + elif args[0].upper() in MANUAL: # TODO ajouter args + if "-s" in args: + name = args[1] + i = 2 + while args[i] != "-s": + name += (" " + args[i]) + i+=1 + seq = int(args[i+1]) + else: + name = " ".join(args[1:]) + seq = 0 + add_manual(table, config, seq, name) elif args[0].upper() in CALIB: # TODO ajouter args add_calib(table, config) elif args[0].upper() in ST: