Skip to content

Commit

Permalink
undo
Browse files Browse the repository at this point in the history
  • Loading branch information
sagitta42 committed Oct 5, 2023
1 parent 2e8bfc0 commit c9f4d68
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
5 changes: 0 additions & 5 deletions src/noise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,8 @@ function simulate_noise(wf::RDWaveform, preamp::PreAmp)
# wf values are in eV (without u"eV" units attached), noise sigma is in keV
# if we're not simulating noise from scratch, we'll do this anyway, but noise sigma will be 0
# -> maybe there's a better way?
<<<<<<< HEAD
noise_σ = preamp.noise_σ_keV == 0u"keV" ? preamp.noise_σ_ADC / preamp.gain : uconvert(u"eV", preamp.noise_σ_keV)
noise_σ = ustrip(u"eV", noise_σ)
=======
noise_σ = preamp.noise_σ_keV == 0 ? preamp.noise_σ_ADC / preamp.gain : uconvert(u"eV", preamp.noise_σ_keV)
noise_σ = ustrip(noise_σ)
>>>>>>> 81cbf00 (gain instead of Emax, ADC options and more)
gaussian_noise_dist = Normal(T(0), T(noise_σ))
RDWaveform(wf.time, wf.signal .+ rand!(gaussian_noise_dist, similar(wf.signal)))
end
Expand Down
23 changes: 0 additions & 23 deletions src/preamp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ This struct is currently mutable because in the case of noise modelling based on
# # typemax(UInt16) / ((max_e+offset_keV)/uconvert(u"keV", germanium_ionization_energy)) # ADC/charge
# typemax(UInt16) / uconvert(u"eV", max_e + offset_keV) # ADC/eV
# end
<<<<<<< HEAD
gain::typeof(1.0/1u"eV") = 0.0138/u"eV"
=======
gain::typeof(1.0/1u"eV")
>>>>>>> 81cbf00 (gain instead of Emax, ADC options and more)
# gain = offset == 0u"keV" ? 0 : typemax(UInt16) / ((max_e+offset)/uconvert(u"keV", germanium_ionization_energy))
# gain = offset_ADC == 0 ? : ( typemax(UInt16) - offset_ADC ) * uconvert(u"keV", germanium_ionization_energy) / max_e

Expand Down Expand Up @@ -95,7 +91,6 @@ function GenericPreAmp(preamp_config::PropDict)
end

GenericPreAmp(
<<<<<<< HEAD
τ_decay = haskey(preamp_config, :t_decay_in_us) ? T(preamp_config.t_decay_in_us)*u"μs" : 50u"μs",
τ_rise = haskey(preamp_config, :t_rise_in_ns) ? T(preamp_config.t_rise_in_ns)*u"ns" : 100u"ns",
# optional, if not given usually means NoiseFromData is used -> make a better system for managing this!
Expand All @@ -106,18 +101,6 @@ function GenericPreAmp(preamp_config::PropDict)
# optional, if not given usually means NoiseFromData is used -> make a better system for managing this!
noise_σ_ADC = haskey(preamp_config, :noise_sigma_ADC) ? T(preamp_config.noise_sigma_ADC) : 0,
noise_σ_keV = haskey(preamp_config, :noise_sigma_keV) ? T(preamp_config.noise_sigma_keV)u"keV" : 0u"keV"
=======
τ_decay=T(preamp_config.t_decay)*u"μs",
τ_rise=T(preamp_config.t_rise)*u"ns",
# optional, if not given usually means NoiseFromData is used -> make a better system for managing this!
offset_keV = haskey(preamp_config, :offset_in_keV) ? T(preamp_config.offset_in_keV)u"keV" : 0u"keV",
offset_ADC = haskey(preamp_config, :offset_in_ADC) ? T(preamp_config.offset_in_ADC) : 0,
# max_e = T(preamp_config.max_e)u"keV",
gain = preamp_config.gain/u"eV",
# optional, if not given usually means NoiseFromData is used -> make a better system for managing this!
noise_σ_ADC = haskey(preamp_config, :noise_sigma_ADC) ? T(preamp_config.noise_sigma_ADC) : 0,
noise_σ_keV = haskey(preamp_config, :noise_sigma_keV) ? T(preamp_config.noise_sigma_keV)u"keV" : 0u"keV"
>>>>>>> 81cbf00 (gain instead of Emax, ADC options and more)
)
# ToDo ! insert check if both offset in keV and ADC is provided is bad
end
Expand Down Expand Up @@ -173,15 +156,9 @@ function simulate(wf::RDWaveform, preamp::GenericPreAmp)

## offset
# wf values are in eV but without u"eV" attached
<<<<<<< HEAD
offset_eV = ustrip(uconvert(u"eV", preamp.offset_keV))
# if ADC offset is used, offset_keV is zero
wf_preamp = RDWaveform(wf_preamp.time, wf_preamp.signal .+ offset_eV)
=======
offset_keV = ustrip(uconvert(u"eV", preamp.offset_keV))
# if ADC offset is used, offset_keV is zero
wf_preamp = RDWaveform(wf_preamp.time, wf_preamp.signal .+ offset_keV)
>>>>>>> 81cbf00 (gain instead of Emax, ADC options and more)

## gain
# gain is in eV^-1
Expand Down

0 comments on commit c9f4d68

Please sign in to comment.