I wanted to experiment with submitting an entire catalog (exported from vizier and filtered for appropriate FOV based on my rig specifications).
Doing this by hand could be a chore.
Since I already had a script (see my other post) to submit an entire target with pre-burnt parameters, I wanted to create a way to batch submit an entire catalog (via a csv).
So there's this python script I wrote:
Code:
import requests
import csv
import sys
from distutils.util import strtobool
if len(sys.argv) < 6:
print("Please pass the catalog csv file as an argument plus ACP IP and Port and username and passwd")
exit(-1)
url = 'http://' + sys.argv[2] + ':' + sys.argv[3] + '/ac/asentiretarget.asp'
print (" Reading Targets from " + sys.argv[1] + "...")
filters = ["Lum", "Red", "Green", "Blue", "Ha", "SII", "OIII"]
subs = {'Lum' : 180.0, 'Red' : 600.0, 'Blue' : 600.0, 'Green' : 600.0, 'Ha' : 1200.0, 'SII' : 1200.0, 'OIII' : 1200.0}
total = {'Lum' : 6.0, 'Red' : 3.0, 'Blue' : 3.0, 'Green' : 3.0, 'Ha' : 15.0, 'SII' : 15.0, 'OIII' : 15.0}
with open(sys.argv[1], newline='') as catalogs:
reader = csv.DictReader(catalogs)
for target in reader:
target["visOnly"] = "false"
target["isOrb"] = "dsky"
for filter in filters:
if strtobool(target[filter]):
target[filter] = "yes"
target[filter + "Hrs"] = total[filter]
target[filter + "Subs"] = subs[filter]
else:
target.pop(filter)
print("Submitting Target ")
print(target)
resp = requests.post(url, data = target, auth = (sys.argv[4], sys.argv[5]))
print("Response from Namid ACP: ")
print(resp)
print("\n\n")
Since we are batch submitting and could end up with a whole bunch of unwated targets if we are not careful. I then also wrote a way to batch delete them:
Code:
import requests
import csv
import sys
from distutils.util import strtobool
if len(sys.argv) < 7:
print("Please pass the beginning and ending ids (inclusive) plus ACP IP and Port and username and passwd")
exit(-1)
url = 'http://' + sys.argv[3] + ':' + sys.argv[4] + '/sc/seditproj.asp'
for id in range(int(sys.argv[1]),int(sys.argv[2]) + 1):
params= {};
params["op"] = "delete"
params["id"] = id
print('Deleting Target {0}'.format(id))
resp = requests.post(url, data = params, auth = (sys.argv[5], sys.argv[6]))
print("Response from Namid ACP: ")
print(resp)
print("\n\n")
With batch delete, you need the project ids. You can get this from exploring the scheduler mdb file from Microsoft Access or other programs which will let you introspect it. Another way you can do it is to open the scheduler browser in the web and opening a project along with the browser inspection tool and see what the payload of the request to delete it. This will give you the project id. If you used the batch submit these ids will be contiguous.
I admit these are dirty hacks. But they work for me and could for you.
Ideally, schedule browser desktop program would offer a way to batch modify targets, but this does not exist as a feature. <hint> <hint> Bob Denny