I’m trying to read the EFixed value from a workspace without success. This seems to need an ExperimentInfo, but I can’t work out how to get a handle on it.
For spectrum info I can use:
ws = mtd['iris88490_graphite002_red']
spec_info = ws.spectrumInfo()
twoth = [i.twoTheta for i in spec_info]
print (twoth)
Although it is possible to use ws.getExperimentInfo() on an event workspace, this is not possible on a workspace 2D.
I would imagine I should be able to use something like:
that will work for me in a hacky way for my script. I’m trying to get it to work with different detector groupings and I can’t guarantee that a given detector is present or know which spectrum number it is associated with. Is there a way to get a DetectorID from a spectrum number or EFixed for a spectrum?
You could also use ws.getInstrument().getNumberParameter(‘EFixed’)[0]
Efixed for indirect geometry is the d-spacing of the analyser. Why would this depend on detectorID?
The EFixed would not depend on DetectorID. I would normally go for spectrum[0], as that is present independent of how reduction is done. If I went for ws.getEFixed(det3), but the detector was not involved in the reduction, then it would fail.
On the workspace I’ve tested on, your command doesn’t work for me. The following worked: energy = ws.getInstrument().getDetector(3).getNumberParameter('Efixed')[0]
where the DetectorID was 3.
so the detectorIDs relevant to your spectrum are extracted and one of them is then used for the EFixed value. I get that it’s annoying that you have to reference the DetectorID when it’s the same value for all, at least in this case.
Reading around a bit more (I’m very much still learning python & Mantid), it seems that there should be a better way of what I’m trying to do.
What I really want to do is to set an instrument (IRIS or OSIRIS), then the instrument configuration (analyser & reflection), then read some of the parameter values from the IDF and parameters file.
All this is done in the indirect scripts. There are lots of routines in the scripts IndirectCommon.py & IndirectNeutron.py which you can find in the ManidInstall scripts/inelastic directory