Donald McLean's Suggested Refactorings

Issue: SynPhot object

Question: Why does each instrument have its own SynPhot?

The answer appears to be that someone was thinking that there might be seperate SynPhot servers for each instrument. This appears to be an unnecessary generalization that we can refactor out, simplifying several things.

Even if each instrument DID need its own SynPhot settings, the best way to do it would be to change fMasterSynPhot back to a non-static object, put the SynPhot parameters back in the instrument model dat files, but have SynPhot's initFromResources handle them.

Files affected:

  1. SynPhot.dat
  2. ACSInstrumentModel.dat
  3. STISInstrumentModel.dat
  4. Wfpc2InstrumentModel.dat
  5. HstInstrumentModel.java
  6. SynPhot.java

Issue: Spectroscopic Mode

In InstrumentModel there is a function "isSpectroscopySupported" which returns true by default. In Wfpc2InstrumentModel, this is overridden to return false.

This should really be a .dat file parameter.

Does ACS even have an instrument mode? If not, then the ACSInstrumentMode object is incorrect and should also have overridden this function.

Files affected:

  1. Wfpc2InstrumentModel.dat
  2. ACSInstrumentModel.dat
  3. STISInstrumentModel.dat
  4. InstrumentModel.java
  5. WFPC2InstrumentModel.java

Issue: Instrument SynPhot parameters

Considering that the general SEA approach is to put things in the XML files rather than hard code them, I can't imagine why they didn't do this with the three SynPhot parameters (mag form, instrument name, spec elem).

Files affected:

  1. HSTInstrumentModel.java
  2. ACSInstrumentModel.java
  3. Wfpc2InstrumentModel.java
  4. STISInstrumentModel.java
  5. ACSInstrumentModel.dat
  6. WFPC2InstrumentModel.dat
  7. STISInstrumentModel.java

Issue: Create Instrument Behavior

In the HSTInstrumentModel classes, the create instrument call creates an instance of HSTInstrument and then performs two calls to set the detector and filter to hard coded values. Putting these values into the .dat files would allow the create instrument call to be moved up to the HSTInstrumentModel base class.

Files affected:

  1. HSTInstrumentModel.java
  2. ACSInstrumentModel.java
  3. STISInstrumentModel.java
  4. WFPC2InstrumentModel.java
  5. ACSInstrumentModel.dat
  6. STISInstrumentModel.dat
  7. WFPC2InstrumentModel.dat

Issue: Nearly obsolete classes

As a result of the previous refactorings, the WFPC2InstrumentModel class and the ACSInstrumentModel class now have only one member function remaining - the constructor with a call to super with a hard coded object name and XML file path. By making a couple of minor changes to the "Resource" class's buildResourceable method to look for and use a "ResourceFile" property, I was able to completely remove these two classes. Note that the STISInstrumentModel class has two non-trivial functions so it can't be removed just yet.

Files affected:

  1. Resources.java
  2. HstObservatory.dat
  3. ACSInstrumentModel.java
  4. Wfpc2InstrumentModel.java

Copyright© 2000 The Association of Universities for Research in Astronomy, Inc. All Rights Reserved.