11import numpy as np
22import pandas as pd
33from astropy .time import Time
4- from VOEventLib .VOEvent import Field , Table , What
5- from VOEventLib .Vutil import stringVOEvent , utilityTable
64
75from gwemopt .scheduler import computeSlewReadoutTime
86from gwemopt .utils import angular_distance
@@ -60,139 +58,6 @@ def read_schedule(schedule_path):
6058 return schedule
6159
6260
63- def export_schedule_xml (xmlfile , coverage_struct , config_struct ):
64- what = What ()
65-
66- table = Table (name = "data" , Description = ["The datas of GWAlert" ])
67- table .add_Field (
68- Field (
69- name = r"grid_id" ,
70- ucd = "" ,
71- unit = "" ,
72- dataType = "int" ,
73- Description = ["ID of the grid of fov" ],
74- )
75- )
76- table .add_Field (
77- Field (
78- name = "field_id" ,
79- ucd = "" ,
80- unit = "" ,
81- dataType = "int" ,
82- Description = ["ID of the filed" ],
83- )
84- )
85- table .add_Field (
86- Field (
87- name = r"ra" ,
88- ucd = r"pos.eq.ra " ,
89- unit = "deg" ,
90- dataType = "float" ,
91- Description = [
92- "The right ascension at center of fov in equatorial coordinates"
93- ],
94- )
95- )
96- table .add_Field (
97- Field (
98- name = "dec" ,
99- ucd = "pos.eq.dec " ,
100- unit = "deg" ,
101- dataType = "float" ,
102- Description = ["The declination at center of fov in equatorial coordinates" ],
103- )
104- )
105- table .add_Field (
106- Field (
107- name = "ra_width" ,
108- ucd = " " ,
109- unit = "deg" ,
110- dataType = "float" ,
111- Description = ["Width in RA of the fov" ],
112- )
113- )
114- table .add_Field (
115- Field (
116- name = "dec_width" ,
117- ucd = "" ,
118- unit = "deg" ,
119- dataType = "float" ,
120- Description = ["Width in Dec of the fov" ],
121- )
122- )
123- table .add_Field (
124- Field (
125- name = "prob_sum" ,
126- ucd = "" ,
127- unit = "None" ,
128- dataType = "float" ,
129- Description = ["The sum of all pixels in the fov" ],
130- )
131- )
132- table .add_Field (
133- Field (
134- name = "observ_time" ,
135- ucd = "" ,
136- unit = "sec" ,
137- dataType = "float" ,
138- Description = ["Tile mid. observation time in MJD" ],
139- )
140- )
141- table .add_Field (
142- Field (
143- name = "airmass" ,
144- ucd = "" ,
145- unit = "None" ,
146- dataType = "float" ,
147- Description = ["Airmass of tile at mid. observation time" ],
148- )
149- )
150- table .add_Field (
151- Field (name = "priority" , ucd = "" , unit = "" , dataType = "int" , Description = ["" ])
152- )
153- table_field = utilityTable (table )
154- table_field .blankTable (len (coverage_struct ["moc" ]))
155-
156- for ii in range (len (coverage_struct ["moc" ])):
157- data = coverage_struct ["data" ][ii , :]
158-
159- ra , dec = data [0 ], data [1 ]
160- observ_time , field_id , prob , airmass = (
161- data [2 ],
162- data [5 ],
163- data [6 ],
164- data [7 ],
165- )
166-
167- table_field .setValue ("grid_id" , ii , 0 )
168- table_field .setValue ("field_id" , ii , field_id )
169- table_field .setValue ("ra" , ii , ra )
170- table_field .setValue ("dec" , ii , dec )
171- table_field .setValue ("ra_width" , ii , config_struct ["FOV" ])
172- table_field .setValue ("dec_width" , ii , config_struct ["FOV" ])
173- table_field .setValue ("observ_time" , ii , observ_time )
174- table_field .setValue ("airmass" , ii , airmass )
175- table_field .setValue ("prob_sum" , ii , prob )
176- table_field .setValue ("priority" , ii , ii )
177-
178- table = table_field .getTable ()
179- what .add_Table (table )
180- xml = stringVOEvent (what )
181- lines = xml .splitlines ()
182- linesrep = []
183- for line in lines :
184- linenew = (
185- line .replace (">b'" , ">" )
186- .replace ("'</" , "</" )
187- .replace ("=b'" , "=" )
188- .replace ("'>" , ">" )
189- )
190- linesrep .append (linenew )
191- xmlnew = "\n " .join (linesrep )
192- with open (xmlfile , "w" ) as fid :
193- fid .write (xmlnew )
194-
195-
19661def summary (params , map_struct , coverage_struct , catalog_struct = None ):
19762 filts = list (set (coverage_struct ["filters" ]))
19863 for jj , telescope in enumerate (params ["telescopes" ]):
@@ -201,8 +66,6 @@ def summary(params, map_struct, coverage_struct, catalog_struct=None):
20166
20267 config_struct = params ["config" ][telescope ]
20368
204- export_schedule_xml (schedulexmlfile , coverage_struct , config_struct )
205-
20669 if (params ["tilesType" ] == "hierarchical" ) or (params ["tilesType" ] == "greedy" ):
20770 fields = np .zeros ((params ["Ntiles" ][jj ], len (filts ) + 2 ))
20871 else :
0 commit comments