Skip to content

Commit

Permalink
Remove WISE offset (#109)
Browse files Browse the repository at this point in the history
* Times in the WISE IRSA Metadata table are mid-observation

There was a 4.4 second offset when downloading FOVs which should not exist.

* Optimize loading MPC Observations from text

* changelog

* black
  • Loading branch information
dahlend authored Sep 4, 2024
1 parent 237f1b2 commit 71ea8c7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
done at the Palomar Observatory.
- Added sunshield rotation calculation for NEO Surveyor.

### Fixed

## [0.3.0] - 2024 - 8 - 28
- Fixed a time offset in the FOV's downloaded from IRSA WISE/NEOWISE. They were offset
by 4.4 seconds.


## [0.3.0] - 2024 - 8 - 28

### Added

- Added an Omni-Directional Field of View.
Expand Down
39 changes: 21 additions & 18 deletions src/kete/mpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,27 +874,26 @@ def from_lines(cls, lines, load_sc_pos=True):
"""
Create a list of MPCObservations from a list of single 80 char lines.
"""
lines = lines.copy()

jds = []
for line in lines:
year, month, day = line[15:32].strip().split()
jds.append(Time.from_ymd(int(year), int(month), float(day)).jd)

found = []
while len(lines) > 0:
line = cls._read_first_line(lines.pop(0))
line["jd"] = jds.pop(0)
if line["note2"] in "WwQqVvRrXx":
idx = 0
unsupported = set("WwQqVvRrXx")
while True:
if idx >= len(lines):
break
line = cls._read_first_line(lines[idx])
idx += 1
if line["note2"] in unsupported:
# unsupported or deprecated observation types
continue
if line["note2"] == "s" or line["note2"] == "t":
raise ValueError("Second line of spacecraft observation found alone")
if line["note2"] == "S" or line["note2"] == "T":
if len(lines) == 0:
raise ValueError("Missing second line of spacecraft observation.")
pos_line = lines.pop(0)
jds.pop(0)
elif line["note2"] == "s" or line["note2"] == "t":
logger.warning("Second line of spacecraft observation found alone")
continue
elif line["note2"] == "S" or line["note2"] == "T":
if idx >= len(lines):
logger.warning("Missing second line of spacecraft observation.")
break
pos_line = lines[idx]
idx += 1
if load_sc_pos:
line["sun2sc"] = cls._read_second_line(pos_line, line["jd"])
found.append(cls(**line))
Expand All @@ -903,6 +902,9 @@ def from_lines(cls, lines, load_sc_pos=True):
@staticmethod
def _read_first_line(line):
mag_band = line[65:71].strip()

year, month, day = line[15:32].strip().split()
jd = Time.from_ymd(int(year), int(month), float(day)).jd
if len(mag_band) > 0:
mag_band = mag_band.split(maxsplit=1)[0]
contents = dict(
Expand All @@ -915,6 +917,7 @@ def _read_first_line(line):
mag_band=mag_band,
obs_code=line[77:80],
sun2sc=None,
jd=jd,
)
return contents

Expand Down
6 changes: 1 addition & 5 deletions src/kete/wise.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,11 +579,7 @@ def fetch_WISE_fovs(phase):
f"WHERE mjd >= {mjd_start} and mjd < {mjd_end}"
)

# Adding 4.4 seconds for the offset due to W3/4 exposures taking 8.8 seconds
jd = [
Time.from_mjd(mjd, scaling="utc").jd + 5.092592592592592e-05
for mjd in list(res.mjd)
]
jd = [Time.from_mjd(mjd, scaling="utc").jd for mjd in list(res.mjd)]
res["jd"] = jd

fovs = []
Expand Down

0 comments on commit 71ea8c7

Please sign in to comment.