-
Notifications
You must be signed in to change notification settings - Fork 3
Combining multi gas scattering with simulated ins resolution in fake data generator #53
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
Merged
taliaweiss
merged 105 commits into
develop
from
combining_multi_gas_scattering_with_simulated_ins_resolution_in_fake_data_generator
Jan 22, 2026
Merged
Changes from all commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
0b00553
fixed gas_scatter_proportion tested
casesyh 9bf9ca2
add chi2 calculation
casesyh bb0bc61
fix the checking of scatter spectra file
casesyh fab92a7
fix the checking of scatter spectra file
casesyh c173168
internal config error
casesyh fa62da5
fix magnetic field mismatch between notebook and mermithid result
casesyh 96f1259
add radiation loss
casesyh a27dc40
check in before adding file for composite trap fitting
casesyh 021156b
composite gaussian resolution function implemented
casesyh 6727ea2
add poisson chi2
casesyh 5a8fae7
update KrComplexLineShape to use simulated resolution for fake data g…
casesyh 69617b9
add convolve_ins_resolution
casesyh 6ac5ac1
resolve probabilities containing NaN
casesyh d5d090a
testing stan analysis test scripts in termite
casesyh a582ef7
use termite script for testing
casesyh e04a4f3
update the files
casesyh be09e5a
delete configuration for magnetic field
casesyh 5825a96
make path_to_ins_resolution_data_txt configurable in fake_data_stan_a…
casesyh 352c672
test resolution function configurable
casesyh d5ddea3
Loading/using simulated resolution file
taliaweiss 1494fd0
Adopting YuHao's simulated res file naming
taliaweiss 186ee0f
Sample simulated resolution counts rates to account for errors
taliaweiss 10c08f3
add MultiGAsComplexLineShape.py
casesyh 7c013dc
np.random in convolve_ins_resolution
casesyh cc4f411
update convolve_ins_resolution_combining_four_trap
casesyh bd27aaa
update convolve_ins_resolution_combining_four_trap
casesyh acf830a
started adding new options re ins resolution
taliaweiss 5fd5dde
Merge branch 'simulated_ins_resolution_in_fake_data_generator' of htt…
taliaweiss 3231065
add dirac peak option to every make_spectrum
casesyh 0d6cd30
change fix_ftc to use_simulated_inst_reso
casesyh 33dece6
add configuration use_combined_four_trap_inst_reso
casesyh 5474e89
add configuration use_combined_four_trap_inst_reso in FakeDataGenerat…
casesyh a9b1ac7
Continued YuHao's work adding trap combining/error sampling
taliaweiss ab5ecc1
Made my naming consistent with YuHao's
taliaweiss d3496c9
Set radiation loss to True by default
taliaweiss 673bd51
add base_shape configuration to multi gas line shape processor
casesyh c03617e
Make B-field fixed input for fake data gen
taliaweiss e0693de
Merge branch 'simulated_ins_resolution_in_fake_data_generator' of htt…
taliaweiss 726b88d
Added missing commas
taliaweiss fd5eead
put emitted_peak = self.base_shape inside make_spectrum functions
casesyh 684ca43
fixed various small errors in implementation of new features
taliaweiss ab86d1d
prepare to add smeared triangle resolutio and gaussian+lorentzian res…
casesyh 2871962
Fixed errors; added temporary diagnoistic plots
taliaweiss 7801316
Changed default inst res files
taliaweiss 3fc6772
Fixed temporary diagnostic plots
taliaweiss f884b91
add smeared triangle and gaussian + lorentzian reoslution
casesyh d0bf786
Enabled FakeDataGenerator to use complex ls as func of K
taliaweiss 6d99c11
Fixed scatter peak bug; removed temporary plots/printing
taliaweiss dc418e7
Set bin width of std_eV_array manually
taliaweiss aed8ddc
Changed default simulated res to T2 version
taliaweiss 6cf5179
push the changes in there
casesyh 2cd91fa
add fitting with composite gaussian lorentzian resolution
casesyh 350f496
fix survival probability
casesyh 8227397
fixed survival probability free scatter proportion
casesyh d70e4c0
add fitting with partially fixed scatter proportion
casesyh a94dfc5
update fitting with fixed survival probability partially fixed scatte…
casesyh 2229336
add mass 28 gases
casesyh 5fbb06f
make gases and scatter proportion configurable
casesyh 2323155
make gases and scatter_proportion configurable
casesyh 6325498
add elevated, composite, composite with pedestal factor gaussian reso…
casesyh bb46e17
composite gaussian resolution scaled and simulated resolution scaled
casesyh 86dee6e
add fitting with simulated resolution scaled and fit reconstruction e…
casesyh 033937d
test git it's been a while
casesyh 514305d
make recon eff param configurable
casesyh fbb7b49
Merge branch 'multi_gas_scattering' into combining_multi_gas_scatteri…
casesyh 4bc4e14
fix typo in variable name recon_eff_param_c
casesyh bf8f2a1
Fixed the interface between the fake data generator and the complex l…
huyanxy b376b79
Merge branch 'combining_multi_gas_scattering_with_simulated_ins_resol…
huyanxy cac1723
Testing merge of simulated_ins... and multigas... branches
taliaweiss 50089b1
Merge branch 'combining_multi_gas_scattering_with_simulated_ins_resol…
taliaweiss b32b50b
Testing changes
taliaweiss a160e85
added more configurables in the fake data generator. Changed variabl…
huyanxy 1249f6a
organized configs
huyanxy 26b7b1d
Testing recon eff in Stan
taliaweiss 3d94d86
Fixed bug in recon eff implementation in complex lineshape
taliaweiss b830e9c
Removed double-definition of self.scatter_proportion in FakeDataGener…
taliaweiss 2fc7e17
move self.shakeSpectrumClassInstance into InternalConfigure
casesyh 7d29504
Commenting changes
taliaweiss c7ff7a3
Merge branch 'combining_multi_gas_scattering_with_simulated_ins_resol…
taliaweiss 236a737
add a few comments above the make spectrum's
casesyh 97386cf
Merge branch 'combining_multi_gas_scattering_with_simulated_ins_resol…
taliaweiss ff744ef
Merged in develop; added comments to FakeDataGenerator's InternalConf…
taliaweiss 0283d97
added shake json file path in the fake data generator; fixed bug (ext…
huyanxy 7719ce2
fixed result dictionary keys for the fitted survival probability. No…
huyanxy fc3a164
changed comments about the options for the resolution function config
huyanxy bf49a03
Removed unnecessary path config from FakeDataGenerator
taliaweiss 4f37578
Pulling Xueying's changes
taliaweiss f16a5e6
fix bug (incorrect function name)
huyanxy 6a2dd07
fix bug (incorrect function name in multi gas lineshape)
huyanxy a0f279e
removed self.path_to_quad_trap_eff_interp variable (no longer needed)
huyanxy fbacdb7
fix make spectrum function call bug in method spectrum_func_composite…
casesyh 021ddca
make self.shakeSpectrumClassInstance configuration only happen when s…
casesyh 5be7d8a
fixed function call in complex lineshape
huyanxy 9d6ca2c
included Yu-Hao's change to the shape spectrum input option
huyanxy a482415
fixed function call
huyanxy 41bbe00
fixed function call
huyanxy 297eb80
Cleaned up code per Christine's recommendations on pull request
taliaweiss 250d3e7
fit with modified exponential scatter peak amplitude ratios
casesyh 2f6f6ed
Added function to compute frac events in ROI for count rate predictions
taliaweiss 7900b6d
Merge branch 'combining_multi_gas_scattering_with_simulated_ins_resol…
taliaweiss aa3a1c3
add survival probability in parameters
casesyh 79909fd
Updated FakeDataGenerator to use correct recon eff model
taliaweiss 0c3398c
Added Dirac delta option to new complex lineshape function, fixed errors
taliaweiss 0bee194
Added gaussian res option to main lineshape model
taliaweiss a87f642
migrating to add gaussian resolution model
casesyh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,9 +39,12 @@ def read_oscillator_str_file(filename): | |
|
|
||
| for line in lines: | ||
| if line != "" and line[0]!="#": | ||
| raw_data = [float(i) for i in line.split("\t")] | ||
| energyOsc[0].append(raw_data[0]) | ||
| energyOsc[1].append(raw_data[1]) | ||
| try: | ||
| raw_data = [float(i) for i in line.split("\t")] | ||
| energyOsc[0].append(raw_data[0]) | ||
| energyOsc[1].append(raw_data[1]) | ||
| except: | ||
| continue | ||
|
|
||
| energyOsc = np.array(energyOsc) | ||
| ### take data and sort by energy | ||
|
|
@@ -62,14 +65,21 @@ def aseev_func_tail(energy_loss_array, gas_type): | |
| A2, omeg2, eps2 = 0.1187, 33.40, 10.43 | ||
| elif gas_type=="Ar": | ||
| A2, omeg2, eps2 = 0.3344, 21.91, 21.14 | ||
| elif gas_type=="N2": | ||
| A2, omeg2, eps2 = 0.21754816, 44.99897054, 20.43916114 | ||
| elif gas_type=="CO": | ||
| A2, omeg2, eps2 = 0.19583454, 55.21888452, 16.44972596 | ||
| elif gas_type=="C2H4": | ||
| A2, omeg2, eps2 = 0.57492182, 23.77501391, 14.33107345 | ||
| return A2*omeg2**2./(omeg2**2.+4*(energy_loss_array-eps2)**2.) | ||
|
|
||
| #convert oscillator strength into energy loss spectrum | ||
| def get_eloss_spec(e_loss, oscillator_strength, kr_17keV_line): #energies in eV | ||
| kinetic_en = kr_17keV_line * 1000 | ||
| kinetic_en = kr_17keV_line | ||
| e_rydberg = 13.605693009 #rydberg energy (eV) | ||
| a0 = 5.291772e-11 #bohr radius | ||
| return np.where(e_loss>0 , 4.*np.pi*a0**2 * e_rydberg / (kinetic_en * e_loss) * oscillator_strength * np.log(4. * kinetic_en * e_loss / (e_rydberg**3.) ), 0) | ||
| argument_of_log = np.where(e_loss > 0, 4. * kinetic_en * e_rydberg / (e_loss**2.) , 1e-5) | ||
| return np.where(e_loss>0 , 1./(e_loss) * oscillator_strength* np.log(argument_of_log), 0) | ||
|
|
||
| # Takes only the nonzero bins of a histogram | ||
| def get_only_nonzero_bins(bins,hist): | ||
|
|
@@ -109,11 +119,10 @@ def energy_guess_to_frequency(energy_guess, energy_guess_err, B_field_guess): | |
| return frequency , frequency_err | ||
|
|
||
| # Given a frequency and error, converts those to B field values assuming the line is the 17.8 keV line | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update comment. error is no longer a parameter here. |
||
| def central_frequency_to_B_field(central_freq,central_freq_err): | ||
| def central_frequency_to_B_field(central_freq): | ||
| const = (2.*np.pi*m_e)*(1+kr_17keV_line/mass_energy_electron)/e_charge | ||
| B_field = const*central_freq | ||
| B_field_err = const*central_freq_err | ||
| return B_field , B_field_err | ||
| return B_field | ||
|
|
||
| # given a FWHM for the lorentian component and the FWHM for the gaussian component, | ||
| # this function estimates the FWHM of the resulting voigt distribution | ||
|
|
||
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
Oops, something went wrong.
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.
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.
why is there no warning or error when the try fails?
should energyOsc not always be read in from the file?