[INSTRM-236] Add .fitsCard field to KeyDictionary definitions. Created: 19/Oct/17 Updated: 12/Jul/18 Resolved: 06/Jun/18 |
|
| Status: | Done |
| Project: | Instrument control development |
| Component/s: | tron_actorcore |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | cloomis | Assignee: | cloomis |
| Resolution: | Done | Votes: | 0 |
| Labels: | FITS | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Sprint: | 2017-10A | ||||||||
| Description |
|
I think we can add a .fitsCard=NAME field to the Keys. which if seen would indicate that the value should be directly written to the FITS headers. |
| Comments |
| Comment by cloomis [ 06/Jun/18 ] |
|
ics_actorkeys dictionary keys can now accept options of the form FITS=(shortName, longName). For example: Key('flow', Float(name='Flow_meter', units='Hz', help='Flow meter reading', FITS=('W_MCFLOW', 'MCP__COOLANT_FLOW'))), The actorcore.utility.fits module has grown the following routine (and typos and brainos, ugh. Sorry):
def gatherHeaderCards(cmd, actor, modelNames=None, shortNames=False):
""" Fetch and return all FITS cards defined in the given models.
Args
----
cmd : an actorcore Command
actor : an actorcore Actor,
Which contans .models.
modelNames : None, or list of strings
The actors to generate keys for. If None, all the models in actor.models
shortNames : bool
If True, use the short FITS names.
Returns
-------
cards : list of fitsio-compatible card dictionaries.
Suitable to get a header with "fitsio.FITSHDR(cards)"
"""
And a routine for starting an image file, which can optionally append a longName to short name translation HDU: def startFitsFile(cmd, filename, cards, img=None, clobber=False, doShortnameHDU=True): """ Write the PHDU and first HDU(s). Args ---- cmd : an actorcore Command filename : string Full pathname for the FITS file. cards : list of fits cards fitsio compatible: strings or dictionaries img : None, or a 2-d image clobber : bool Whether to overwrite any existing file. In production, this should not happen. doShortnameHDU : bool Whether to create a translation HDU if we have short card names. """ Yes, this one should have been reviewed. |