added manual input

This commit is contained in:
Yael-II
2024-11-28 23:29:53 +01:00
parent 75b5f93e6e
commit d985b82d22
2 changed files with 21 additions and 2 deletions

View File

@@ -70,6 +70,7 @@ add an object from simbad
search a region centred on the ra/dec coordinates, search a region centred on the ra/dec coordinates,
with a given radius (coordinates should be expressed as with a given radius (coordinates should be expressed as
`12h30m30s`, `90d30m30s` or `90.555d`) `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 - `sidereal`, `st`: computes the sidereal time for each target
- `sequence`, `seq`: computes the sequence order for each - `sequence`, `seq`: computes the sequence order for each
target target

View File

@@ -22,6 +22,7 @@ READ = ["READ", "OPEN"]
CALIB = ["CALIB", "CALIBRATION"] CALIB = ["CALIB", "CALIBRATION"]
SIMBAD = ["SIMBAD", "OBJECT"] SIMBAD = ["SIMBAD", "OBJECT"]
REGION = ["SEARCH", "REGION"] REGION = ["SEARCH", "REGION"]
MANUAL = ["MANUAL", "ADD"]
ST = ["SIDEREAL", "ST"] ST = ["SIDEREAL", "ST"]
SEQ = ["SEQUENCE", "SEQ"] SEQ = ["SEQUENCE", "SEQ"]
CHECK = ["CHECK"] CHECK = ["CHECK"]
@@ -721,6 +722,10 @@ def print_help():
"search a region centred on the ra/dec coordinates, " "search a region centred on the ra/dec coordinates, "
"with a given radius (coordinates should be expressed as " "with a given radius (coordinates should be expressed as "
"12h30m30s, 90d30m30s or 90.555d)\n" "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- sidereal, st: computes the sidereal time for each target\n"
"\t- sequence, seq: computes the sequence order for each " "\t- sequence, seq: computes the sequence order for each "
"target\n" "target\n"
@@ -731,7 +736,7 @@ def print_help():
"\t- yes, y, 1: yes\n" "\t- yes, y, 1: yes\n"
"\t- no, n, 0, or anything else: no\n" "\t- no, n, 0, or anything else: no\n"
"\t- all, *: select all\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" "\n"
"[1] Pr. Dumbledore, Albus Percival Wulfric Brian, 1992, Hogwarts School of Witchcraft and Wizardry" "[1] Pr. Dumbledore, Albus Percival Wulfric Brian, 1992, Hogwarts School of Witchcraft and Wizardry"
"\033[0m") "\033[0m")
@@ -741,7 +746,8 @@ def resolve_input(text: str,
table: Table, table: Table,
config: dict): 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: @params:
- text: the input string entered by the user - text: the input string entered by the user
- table: the table of targets - table: the table of targets
@@ -771,6 +777,18 @@ def resolve_input(text: str,
obj = Simbad.query_region(region, radius) obj = Simbad.query_region(region, radius)
swap_table = add_simbad(swap_table, obj, config) swap_table = add_simbad(swap_table, obj, config)
select_obj(table, swap_table, 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 elif args[0].upper() in CALIB: # TODO ajouter args
add_calib(table, config) add_calib(table, config)
elif args[0].upper() in ST: elif args[0].upper() in ST: