-
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. (Done for getters, not for mutators). - PR Finish change for mutators above by externalizing change event propagation.
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 Push proper motion into
HmsDegTarget. Remove all calls to proper-motion operations fromSPTarget; instead force client code to ensure that it is dealing with anHmsDmsTarget.
- 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.
- PR 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 everything is immutable and coordinates are always time-varying, so we need to prepare for this.
-
PR Remove public mutators from
ITarget; move them toSPTarget, where the implementation will eventually swap targets out rather than mutate in-place.
The SchedulingBlock on SPObservation will be the basis for most time-based coordinate lookups, so we need to make it available.
-
PR Make an
Option[SchedulingBlock]available in common contexts where coordinates are used.
-
Many PRs Add
ITargetAPI calls to require anOption[SPObservation]and return optional coordinate information. Update existing calls to use new API, coping with missing coordinates in each case.
- Add
.isTOOtoITargetand factor out code that looks for an emptyHmsDegTarget.
-
PR Remove
ConicTargettypes; we are dropping support. Existing ones will become 1-point ephemeris targets. -
PR Remove
NamedTarget.. will need to covert existing ones to nonsidereal with empty ephemeris. - Update ephemeris model to allow easy slicing and comparison. Prototype here.
- PR PIO serializers for new model.
-
TargetConfigfor new model. - add spectral distribution, spatial profile
These changes will need to happen on a branch that is kept up to date with develop, which gets harder and harder as time goes on. So this work should be completed quickly. Some parts may be doable in isolation, like new target editors (which can go into the trunk but will not be visible to users yet).
- add new Target member
- turn ITarget back into an interface and make a wrapper for new model.
- update methods on TransitionalSPTarget to swap out immutable targets
- P1/P2 target conversion (if PIT has not yet moved to core model)
- Assign default scheduling block
- Conic ~> Nonsidereal (+ assign scheduling block)
- HMS ~> TOO or Sidereal
- Named ~> Named
- Make scheduling block visible always
- Update target editor. Borrow ephemermis editor/upload from PIT?
- Some kind of menu item to write
.ephfiles to TCS install dir
- scheduling block must be defined for nonsidereal targets
- ephemeris must be defined for entire scheduling block
- add cron task to write
.ephfiles to TCS
Plan for the weeks of Sep 13 (Green) and Sep 20 (Orange). We are uncommitted prior to the green line. Sorry the image is so small. You can click to embiggen.
