Refactoring #2011

API changes to access the simulation results

Added by ganeva over 1 year ago.

Status:NewStart date:14 Mar 2018
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

Request: plot simulated and experimental data together in the same units, the same scale, with the same ROI and the same masks.

Problems.
1. If detector resolution is present, masked area looks noisy. To avoid that, I set the all masked bins to have zero signal:

simulation.runSimulation()
result = simulation.result().histogram2d(ba.AxesUnits.MM)
for i in range(result.getTotalNumberOfBins()):
    if simulation.getInstrument().getDetectorMask().isMasked(i):
        result.setBinContent(i, 0)

Better would be if simulation would return already correct result, so that this step will not be necessary any more.

2. There is no way to apply the mask to the experimental data. The work around is:

def apply_mask(from_data, to_data):
    for i in range(from_data.getTotalNumberOfBins()):
        if from_data.getBinContent(i) == 0:
            to_data.setBinContent(i, 0)

to be continued

Also available in: Atom PDF