Subject: Common structure / function for spectra Dear all, as second part of my actions from our meeting, here are some propositions to handle spectra. Your comments are very welcome, it is actually a bit disconcerting to have resounding silence on these mails - some of you should be affected, for the last mail (events) even more than for the current. Based on the existing OGIP/ISDC data structures for spectra I'd propose the following generic structure: typedef struct { char spectrumID[DAL_MED_STRING]; /* -> ROWID of PHA II */ unsigned short channel[J_NUM_PI_BINS]; double rate[J_NUM_PI_BINS]; double errStat[J_NUM_PI_BINS]; double errSys[J_NUM_PI_BINS]; int quality[J_NUM_PI_BINS]; double exposure; double timeElapsed; double timeOn; double deadtimeCorrectionFactor; double timeFirst; double timeLast; Event_type eventType; /* e.g. JEMX_FULL, JEMX_REST */ } JEMXspectrum; Note that one could also include these things in higher level structs: typedef struct { ... double RA; double Dec; JEMXspectrum spectrum; ... } JEMXsource; which you could then access as in: (src[i]).spectrum.exposure=summedExposure; if defined src as an array of JEMXsource. The question is for me what kind of functions one would need to go with that. Clearly a useful function would write out a spectrum to a table. But would we rather have a function that takes a JEMXspectrum and additional parameters, e.g., for the source info, or functions written around higher level structs still? Also I could imagine functions to: * Initialize a spectrum / an array of spectra to zero * Add N selected, contigous events to a spectrum * Do basic mathematical operations on two spectra Any more ideas? Regards, Peter