public class Observation_Timeline
extends java.lang.Object
Observation_Event
s. Observation events may be
added to and removed from the timeline by name, which is typically the
observation's Observation_ID
, although it is not
required to be so. Whenever an observation event is added, the timeline is
sorted accord to the natural sort order of the events, which is the start
time. The timeline's units are assumed to be seconds.
The isPowerOn(double)
boolean method may be used to determine
whether HiRISE is powered on at a given time. The toXySeries()
method may be used to create a JFreeChart XYSeries
suitable for
plotting in a JFreeChart
.
HiRISE uses a first-in, first-out command queue to operate. Nearly all HiRISE commands go through this queue, including every command used in the acquisition of a HiRISE observation. This queue makes it impossible for the HiRISE system itself to ensure that an observation started at time t really takes place at time t. If some other commands are still running on the system, the observation will be bumped along in time until its commands reach the front of the queue.
Thus, if a 45-second observation is scheduled for 15:00:00 UTC and another 45-second observation is scheduled for 15:00:30 UTC, the second observation will actually start at 15:00:45 UTC instead of 15:00:30 UTC as commanded.
It is normally up to the planning software (for normal observations) and the JPL flight engineering team (FET) and the HiRISE engineering support team (HiEST) (for special operations) to ensure that two observations do not overlap. Observation_Timeline does not check to make sure such a conflict does not arise.
A future release of Observation_Timeline will model the HiRISE behavior correctly when there are overlapping observations; at the moment, however, it does not. Overlapping observations are modeled as a union of their start times and durations. In the example above, HiRISE would be modeled as being powered up from 15:00:00 UTC to 15:01:15 UTC, instead of from 15:00:00 UTC to 15:01:30 UTC.
Modifier and Type | Class and Description |
---|---|
static class |
Observation_Timeline.TimeFormat
Indicates the output format for the timeline.
|
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
EPOCH_PATTERN |
static java.lang.String |
EPOCH_REGEX |
static java.lang.String |
ID
Class identification name with source code version and date.
|
static java.util.regex.Pattern |
STATE_FILE_PATTERN |
static java.lang.String |
STATE_FILE_REGEX |
Constructor and Description |
---|
Observation_Timeline()
Creates an empty Observation_Timeline object.
|
Modifier and Type | Method and Description |
---|---|
void |
addObservation(Observation_Event event)
Adds an observation event to the timeline.
|
void |
addObservation(java.lang.String identifier,
double startTime,
double duration)
Adds an observation event to the timeline.
|
boolean |
contains(java.lang.String identifier)
Tests if the named observation is included in this timeline.
|
void |
exportToFile(java.io.File file) |
void |
exportToFile(java.io.File file,
Observation_Timeline.TimeFormat format,
java.lang.String stateFilename)
Exports the timeline to a given file with a given format for the start time.
|
double |
getAutoDuration()
Gets a nice duration for the timeline.
|
double |
getDuration()
Gets the duration of the timeline.
|
int |
getIndexForDate(java.util.Date date)
Gets the row index of the the observation whose start time is nearest to,
but not greater than, the indicated date.
|
Observation_Event |
getObservationEvent(java.lang.String id)
Gets the observation event with the indicated ID.
|
java.util.List<java.lang.String> |
getObservationIds(boolean includeArbitrary)
Gets the current set of observation IDs in this timeline.
|
java.util.List<Observation_Event> |
getObservations()
Gets a list of observation events contained in this timeline.
|
int |
getSize()
Gets the number of
Observation_Event s in this timeline. |
double |
getStartTime()
Gets the start time of the timeline.
|
double |
getStopTime()
Gets the stop time of the timeline.
|
boolean |
isPowerOn(double time)
Tests if HiRISE is powered on at a given time.
|
void |
removeObservation(java.lang.String identifier)
Removes an observation from the timeline.
|
org.jfree.data.xy.XYSeries |
toXySeries()
Creates an
XYSeries from this timeline. |
public static final java.lang.String ID
public static final java.lang.String EPOCH_REGEX
public static final java.lang.String STATE_FILE_REGEX
public static final java.util.regex.Pattern EPOCH_PATTERN
public static final java.util.regex.Pattern STATE_FILE_PATTERN
public Observation_Timeline()
public java.util.List<Observation_Event> getObservations()
public Observation_Event getObservationEvent(java.lang.String id)
id
- the observation ID in question.public int getSize()
Observation_Event
s in this timeline.public java.util.List<java.lang.String> getObservationIds(boolean includeArbitrary)
includeArbitrary
- if true, all arbitrary observations are
included; otherwise they are not.public double getStartTime()
public double getStopTime()
public double getDuration()
public double getAutoDuration()
getDuration()
,
rounded to the nearest hour, plus an additional 6 hours. This value is used
for the auto-duration calculations in HiTemp
and HiTemp_Batch
.public int getIndexForDate(java.util.Date date)
date
- the date of interest.public void addObservation(Observation_Event event)
Observation_Event.getIdentifier()
,
it is replaced by the new one.
The timeline is sorted by its natural order when the event is added. The
natural sorting order for an Observation_Event
is its
Observation_Event.getStartTime()
.
event
- the Observation_Event
to be added.public void addObservation(java.lang.String identifier, double startTime, double duration)
The timeline is sorted by its natural order when the event is added. The
natural sorting order for an Observation_Event
is its
Observation_Event.getStartTime()
.
identifier
- the unique ID of the new observation. Typically
this identifier will be the string form of the observation ID
associated with this observation, but it is not required to be so.startTime
- the start time of the new observation.duration
- the duration of the new observation.public void removeObservation(java.lang.String identifier)
identifier
- the unique identifier of the observation to remove.public boolean contains(java.lang.String identifier)
identifier
- the unique ID of the observation.public boolean isPowerOn(double time)
WARNING: This test does not correctly model HiRISE behavior as of this release. See the note in the class introduction.
time
- the time at which the power status is to be tested.public org.jfree.data.xy.XYSeries toXySeries()
XYSeries
from this timeline. This series is suitable
for plotting in a JFreeChart
.
The x-axis is time, sampled at 1.0-second intervals for the duration of the timeline plus 10.0 seconds. The y-axis is the instrument power state, ranging from 0.0 for "off" to 1.0 for "on."
XYSeries
.public void exportToFile(java.io.File file, Observation_Timeline.TimeFormat format, java.lang.String stateFilename) throws java.io.FileNotFoundException
With the exception of the ET format, the various time formats have external
dependencies into which this method has no direct visibility. For example,
the Observation_Timeline.TimeFormat.ORBIT
format requires that a state file be loaded
into the static MTT layer via some external mechanism. If this method is
unable to produce a start time in the desired format, it falls back to ET.
file
- the filename; if null, data are written to
System.out
.format
- the start time format.stateFilename
- the state filename; may be null.java.io.FileNotFoundException
public void exportToFile(java.io.File file) throws java.io.FileNotFoundException
file
- the filename; if null, data are written to
System.out
.java.io.FileNotFoundException
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona