ADD: calibration files from unit-level testing to resource/calibration - #203
Merged
Conversation
Author
And this is the Julia code I used to generate the combined filesusing DelimitedFiles
dets = [
"lbl_HP52366-2_15.83mm_900V_3.53e9_83K",
"lbl_HP52358-2_15.5mm_1050V_4.8e9_83K",
"lbl_HP52432-1_15.83mm_600V_2.12e9_83K",
"m61617-fm2_15.68mm_650V_2.52e9_83K",
"lbl_HP52542-1_15.95mm_800V_2.78e9_83K",
"lbl_HP52358-3_15.6mm_1000V_4.36e9_83K",
"lbl_HP52434-1_15.7mm_1150V_5.38e9_83K",
"lbl_HP52406-1_16.0mm_1000V_4.84e9_83K",
"lbl_HP52542-2_16.1mm_800V_2.73e9_83K",
"lbl_HP52407-3_15.8mm_700V_2.13e9_83K",
"lbl_HP52379-1_15.71mm_700V_2.15e9_83K",
"lbl_HP52358-1_15.67mm_850V_4.68e9_83K",
"lbl_HP52434-2_16.3mm_1000V_3.99e9_83K",
"lbl_HP52361-1_15.57mm_800V_2.92e9_83K",
"m61618-fm3_15.2mm_750V_3.06e9_83K",
"lbl_HP52406-3_15.93mm_1050V_4.53e9_83K"
];
sim_dir = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/unit/simulations/"
fn_out = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/payload/depth-splines-derived-from-unitlevel.csv"
open(fn_out, "w") do io
for (i,det) in enumerate(dets)
fn_in = joinpath(sim_dir, "HV32_LV32_59.5keV_"*det*"_ctd_dt_depth_mcSPICE.csv")
write(io, "### $(i-1)\n")
writedlm(io, readdlm(fn_in, ',', comments = true, comment_char = '#'), ',')
write(io, "\n")
end
end
dets_short = first.(split.(dets, "_1"))
depth_dir = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/unit/depth/"
fn_out = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/payload/depth-coeffs-derived-from-unitlevel.csv"
open(fn_out, "w") do io
for (i,det) in enumerate(dets_short)
fn = only(filter(x -> occursin(det, x), readdir(depth_dir)))
fn_in = joinpath(depth_dir, fn)
A::Matrix{Any} = readdlm(fn_in, ',', comments = true)
A[:,1] .= Int.(A[:,1]) .+ (i-1)*10000
writedlm(io, A, ',')
end
end
ecal_dir = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/unit/ecal/"
dets_short = replace.(first.(split.(dets, "_1")), "lbl_" => "", "m" => "", r"-fm\d" => "")
fn_out = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/payload/full-ecal-derived-from-unitlevel.ecal"
open(fn_out, "w") do io
for (d,det) in enumerate(dets_short)
DetID = d - 1 # start DetID at 0
fn = only(filter(x -> occursin(det, x), readdir(ecal_dir)))
fn_in = joinpath(ecal_dir, fn)
ecal_data = readdlm(fn_in)
for i in findall(x -> x[3] isa Int, eachrow(ecal_data))
@assert ecal_data[i,3] == 0
ecal_data[i,3] = DetID
end
writedlm(io, join.(eachrow(ecal_data), " "))
end
end
taccal_dir = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/unit/taccal/"
dets_short = replace.(first.(split.(dets, "_1")), "lbl_" => "", "m" => "", r"-fm\d" => "")
fn_out = "/home/hagemann/Software/COSItools/nuclearizer/resource/calibration/COSISMEX/payload/taccal-derived-from-unitlevel.csv"
open(fn_out, "w") do io
for (d,det) in enumerate(dets_short)
DetID = d - 1
fn = only(filter(x -> occursin(det, x), readdir(taccal_dir)))
fn_in = joinpath(taccal_dir, fn)
raw_data, header = readdlm(fn_in, ',', header = true)
ints = Int64.(raw_data[:, 1:4])
floats = Float64.(replace(raw_data[:, 5:end],"" => NaN))
taccal_data = Any[ints floats]
if DetID == 0
write(io, "#" * join(header, ',')*'\n')
end
writedlm(io, taccal_data, ",")
end
end |
fhagemann
marked this pull request as draft
August 21, 2026 22:40
Author
fhagemann
marked this pull request as ready for review
August 24, 2026 18:57
The depth coefficients for 406-3 were determined using this TAC calibration file
fhagemann
force-pushed
the
resource
branch
2 times, most recently
from
August 24, 2026 20:26
503c086 to
b147555
Compare
resource/calibrationresource/calibration
Author
|
I also seem to be able to run the DEE with all those files and the mass model in cositools/massmodel-cosi-payload#3 |
ckierans
approved these changes
Aug 25, 2026
ckierans
left a comment
Collaborator
There was a problem hiding this comment.
This is a huge effort, @fhagemann !!! Thank you so much for the careful book keeping!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


In this PR, we add the full ecal, taccal, depth splines and depth coefficients for the 16 flight detectors as determined from the unit-level calibrations, assuming the thicknesses from the table below ("E (sims)") and realized in cositools/massmodel-cosi-payload#3:

Also added are the combined files for all 16 detectors, derived from the individual unit-level files.
Note that for PAYLOAD calibrations, we will use updated thickness (and temperature) values (see cositools/massmodel-cosi-payload#4), that will be added to
resource/calibration/COSISMEX/payload(or whatever we might call the repository) once they become available.