-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ToA lnL first functionas #63
base: master
Are you sure you want to change the base?
Conversation
var res = zeros[float](refLowT.size.int) | ||
# walk over each bin and compute linear interpolation between | ||
let Ediff = abs(lineEnergies[idx] - lineEnergies[idx+offset]) | ||
for i in 0 ..< bins.size: | ||
res[i] = refLowT[i] * (1 - (abs(lineEnergies[idx] - energy)) / Ediff) + | ||
refHighT[i] * (1 - (abs(lineEnergies[idx+offset] - energy)) / Ediff) | ||
result = (bins, res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Later we can refactor out this type of logic from both the regular and ToA versions of this proc into a morphImpl
that takes only the reference data, line energies and returns the bins and result. That way we only have the two procedures to do the "data extraction" from the relevant sources and the actual interpolation logic is shared. But I can do that at a later time.
var dfLoc = newDataFrame() | ||
var lastBins = zeros[int](0) | ||
result = newDataFrame() | ||
for idx, E in energies: | ||
let (bins, res) = morphToA(df, lineEnergies, E, offset = 1) | ||
|
||
block Sanity: | ||
# really the same bins in all Target/Filter combinations? Should be, but check! | ||
if lastBins.size > 0: | ||
doAssert bins == lastBins | ||
lastBins = bins | ||
let suffix = "_" & $idx | ||
dfLoc["Hist" & $suffix] = res | ||
|
||
dfLoc["Bins"] = lastBins | ||
#echo dfLoc | ||
result.add dfLoc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly to the above procedure, the actual logic can also be refactored out into a common procedure for regular / ToA cases. Just needs an argument that hands the internal morphing procedure to call. Again, I can do that later.
Looking good for your first lines of Nim code! 🥳 Added comments mainly for explanatory purposes. The next steps would involve:
Once that is done, we can implement the ToA cut (as you proposed) first. Certainly simpler. This would involve:
If this is done and you have added the ToA cut there, we'd need to do 2 other things (but we'll do that once the implementation is there and works):
|
I forgot the reason we use ~chipGroups~ is to get the different chips of a single run. Arguably a better iterator, that takes the run into account would be better / we could hand the full ~chipBase~ as the starting path to the ~chipGroups~ iterator. But well, this is cheap.
Obviously use with care!
The center chip number is just "centerChip"... :)
throws out all data maybe refdf need to be log?
So that one can run the binary from anywhere on the system and is not dependent on the relative path to the data files.
... to the rate table
Started to inclued the possiblity to use the ToA information for the lnL