-
Notifications
You must be signed in to change notification settings - Fork 26
Target Model, Take 2
// XXX FIXME: Temporary, until nonsidereal support is implemented
— A. Brighton, 7-Nov-2005
Plan A (the violent and monolithic switchover from ITarget to Target) didn't go that well because I made some bad assumptions and didn't understand how a lot of things worked. This is old and terrible code. So now I have a much better idea of the order in which things should happen, so we can do it incrementally. Each of the bullet points below will end up being a distinct JIRA task, or at least a distinct PR.
The old issue is OCSADV-154 but we need to make this more fine-grained and update the old PRs.
These are largely mechanical changes that can be done quickly using refactoring tools. I have worked through most of this already so I know what to expect. These changes can be applied directly to develop and can ship in 15B regardless; nothing here commits us to the new model, and all are things that need to been done anyway.
We can immediately simplify the target API simply by running inspections and removing unused code, and redundant "convenience" methods.
-
PR Remove unused sidereal type
DegDegTarget. -
PR Remove unused methods on
SPTarget, as well asITargetand its subtypes, make things private/protected when possible, and inline methods when appropriate; the intent is to reduce the number of entry points in the API.
There is an old and useless brightness property that we should simply remove. It is sent to the TCC but cannot possibly be used because it's an unstructured string.
-
PR Remove
brightnessfrom model, and remove associated editors. AddTo2015Bprogram updater to populate structured magnitudes based on brightness property when possible, and leave notes behind explaining what happened. -
PR Add an
APband for apparent magnitude, for ephemeris-based targets coming from Phase I. UpdateSpTargetFactoryto push this into Phase II target. -
PR Update
TooTargetto have a proper magnitude table and push it into the created Phase II targets. Will need to change servlet protocol and notify the authorities.
There are now five coordinate systems supported in OCS, but J2000 is the only one that is actually supported (and it is used by literally 99.999% of our targets ... we have enough for that many digits of precision).
I have not worked through this stuff yet. Initially I was going to continue supporting B1950, but it turns out that everything is converted to/from J2000 in the TPE and elsewhere and there's simply no point maintaining the complexity if it has no impact on the user.
- PR Add conversion to change JNNNN and APPARENT to J2000 on import. Each is used only once, the former for engineering in GN-ENG20110920 and the latter for commissioning in GS-2007B-Q-235.
- PR Add conversions to precess B1950 coordinates and proper motion to J2000. Precession code exists in old model but results should be spot-checked by scientists to verify.
-
PR Remove reference frames entirely; FK5/J2000 is the only one now. Remove equinox-specific methods in
SPTargetandITargethierarchy.
Five of seven conic target types are unsupported, and are simply rendered into one of the two remaining types via UI trickery in the OT.
-
PR Add upgrade conversions to remove these types from the science programs; conversion logic lives in
NonSiderealTargetSupport. Remove unsupported types from the model and associated hacks from the OT.
-
PR Add magnitude table to
ITarget(perhaps by just making it into aclass) and add delegates forSPTargetmethods. -
PR Inline
SPTargetdelegate methods so client code is using the target directly, and remove now-unused methods fromSPTarget. Oops, can't finish this because SPTarget has property change list that responds to the setters. Will add another PR at some point.
Lots of code at this point is bifurcated as sidereal/non-sidereal but we want to discourage this specialization. So let's remove the NonSiderealTarget superclass and make code explicitly handle each of the three target types (since there will be two more when the new model arrives).
-
PR Merge
IHorizonsTargetmethods intoINonSiderealTarget. MergeINonSiderealTargetintoNonSiderealTarget. -
PR Clean up redundant methods in
ITargethierarchy. - Push
NonSiderealTargetdown intoConicTargetandNamedTarget. This will require eachinstanceofcheck forNonSiderealTargetbe inspected and fixed. -
PR Remove
CoordinateSystemsuperclass. RemoveSystemNameandSystemOptionnotions from the target model. With the exception of the conic target, which still needs a discriminant, these will all be constants.
These operations are defined only for HmsDegTarget and otherwise fail in various ways.
- PR Remove tracking effective wavelength. It is unused.
-
PR Get rid of stringly PM operations on
SPTarget; change toDouble. - PR Remove mutators unrelated to proper motion.
- Remove all calls to proper-motion operations from
SPTarget; instead force client code to ensure that it is dealing with anHmsDmsTarget. - Remove the now-unused methods from
SPTarget.
Same as above; this work can be committed to develop and ship with 15B
- For all methods on
SPTarget,ITargetand subtypes that consume or produce strings, add comments documenting the format of these strings, and especially which (if any) are ultimately sent to the TCC.
The target editor is going to need a lot of work, so we need to get it in a state where it can be understood a little better. We may end up rewriting the whole thing; this remains unclear. But we can certainly make small improvements now.
-
PR Remove index-based tables in
NonSiderealTargetSupport(and elsewhere, if any) by usingenumand maps rather than index-aligned arrays. - Run inspections on
EdCompTargetList; remove unused code; and aggressively repair things that are stupid.
- Change editor UI to make sidereal, named, comet, and minor planet modes distinct, rather than the latter three being "flavors" of nonsidereal target. It will probably make sense to get rid of the generic and stupid nonsidereal editor since there are only three cases now.
These items are more involved. In the new model coordinates are always time-varying, so we need to prepare for this.
We can't stop supporting conic targets because there are simply too many in the database, but our "support" is nonsensical. We have the conic parameters but don't have code to solve the equations, so instead we just ask the PI to supply one point for use in the TPE, which also displays ephemeris elements, if it can find the target in horizons. There is nothing that ensures the conic parameters are consistent with either horizons or the validAt point.
Originally I was going to leave this as-is, but I would prefer to fix it properly. I don't want special-case code for legacy conic targets.
- Write scala code to solve the conic equations; we will reuse this in the new model. Kepler figured this out in 1609 so it seems like we should be able to do it.
- Leave
validAtdate for now, but compute its value. Remove coordinate setters. - Replace Horizons stuff in editor/TPE with computed values.
- Remove horizons-related information and methods from
ConicTarget.
This one is rough.
- Add time-varying variants of all coordinate getters that return an
Option. - Change all client code to use time-varying getters and to handle the possibility of empty coordinates. This is potentially complex because we need to decide which time to pass, and OCS has been using zero for missing coordinates up until now (and special-casing zero in places, probably). We may want to add something to the target that specifies how the default date should be computed. Needs some thought. We originally considered using (a) the
validAtdate if any, then (b) the start of theschedulingBlock, if any, then (c) the midpoint of the program semester, then (d) the epoch of the target, then (e) J2000.0 ... but this seems too complicated to me. I think we might want something in the TPE that indicates the date range(s) where we know the coordinates, and a way to select a point. - Remove now-unused methods.
- Remove
validAtdate for conic targets.
- Create a typeclass for translation between schema-generated and immutable types. Due to the unfortunate need to pass a
Namerthis can't just bescalaz.Iso. - Create instances for all pairs of types, and change serializing code to use these instances rather than factory and
.mutablemethods in the model. - Remove now-unused methods.
The PIT model isn't quite adequate but it's close. So we need to make some updates there. Much of this work is done.
Copy the PIT model in to spModel.core and then update as follows:
- Remove references to mutable structures (this will be replaced with a typeclass in PIT).
- Expand
Coordinatesto support distinctRAandDecwith shared underlyingAngletype, with parsing and formatting. - Property-based tests for the above; there are a lot of corner cases with sexigesimal formats.
- Add conic target types.
- Make magnitude table a property of all targets (not just sidereal). Chad verified that this is what we want; they need not be time-varying for nonsidereal targets.
- Remove
HorizonsInfofromSiderealTarget; this was an over-generalization.
- Conversions from old model serial structure.
- Serializers for new model.
- Implement
TargetConfigfor new target model. - Test that configs for converted targets are identical to originals.