Skip to content

Commit 57e5f59

Browse files
committed
remove dependence on voeventlib
1 parent 008331a commit 57e5f59

File tree

3 files changed

+1
-139
lines changed

3 files changed

+1
-139
lines changed

gwemopt/io/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from gwemopt.io.export_tiles import export_tiles_coverage_int
2-
from gwemopt.io.schedule import export_schedule_xml, read_schedule, summary
2+
from gwemopt.io.schedule import read_schedule, summary
33
from gwemopt.io.skymap import get_skymap, read_skymap

gwemopt/io/schedule.py

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import numpy as np
22
import pandas as pd
33
from astropy.time import Time
4-
from VOEventLib.VOEvent import Field, Table, What
5-
from VOEventLib.Vutil import stringVOEvent, utilityTable
64

75
from gwemopt.scheduler import computeSlewReadoutTime
86
from 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-
19661
def 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:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ dependencies = [
4141
'astroplan',
4242
'ephem',
4343
'pyyaml',
44-
'VOEventLib',
4544
'joblib',
4645
'ligo-segments',
4746
'ligo.skymap',

0 commit comments

Comments
 (0)