Skip to content

Commit

Permalink
Replace RealQuantity with
Browse files Browse the repository at this point in the history
`Unitful.RealOrRealQuantity`
  • Loading branch information
fhagemann authored and oschulz committed Sep 11, 2024
1 parent a8e7df6 commit 47893c3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Event/Event.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ end

function Event(locations::Vector{<:AbstractCoordinatePoint{T}}, energies::Vector{<:RealQuantity}, N::Int;
particle_type::Type{PT} = Gamma, number_of_shells::Int = 2,
radius::Vector{<:RealQuantity{T}} = radius_guess.(T.(to_internal_units.(energies)), particle_type)
radius::Vector{<:RealQuantity} = radius_guess.(T.(to_internal_units.(energies)), particle_type)
)::Event{T} where {T <: SSDFloat, PT <: ParticleType}

return Event(broadcast(i ->
NBodyChargeCloud(locations[i], energies[i], N, particle_type,
radius = radius[i], number_of_shells = number_of_shells),
radius = T(to_internal_units(radius[i])), number_of_shells = number_of_shells),
eachindex(locations)))
end

Expand Down
2 changes: 1 addition & 1 deletion src/PlotRecipes/Potentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ end

@recipe function f(sp::ScalarPotential{T,3,Cylindrical}; r = missing, φ = missing, z = missing, contours_equal_potential = false, full_det = false) where {T <: SSDFloat}

gradient::Symbol, clims::Tuple{MaybeWithUnits{T},MaybeWithUnits{T}}, name::String, punit::Unitful.Units = _get_potential_plot_information(sp)
gradient::Symbol, clims::Tuple{RealQuantity, RealQuantity}, name::String, punit::Unitful.Units = _get_potential_plot_information(sp)

if !(sp.grid[2][end] - sp.grid[2][1] 2π) sp = get_2π_potential(sp, n_points_in_φ = 72) end

Expand Down
1 change: 1 addition & 0 deletions src/SolidStateDetectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export Event, drift_charges!
export add_baseline_and_extend_tail
export NBodyChargeCloud

using Unitful: RealOrRealQuantity as RealQuantity
const SSDFloat = Union{Float16, Float32, Float64}

include("examples.jl")
Expand Down
6 changes: 0 additions & 6 deletions src/Units.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,6 @@ function construct_units(config_file_dict::AbstractDict)::UnitTuple
return UnitTuple(dunits)
end



const MaybeWithUnits{T} = Union{T, Quantity{<:T}}
const RealQuantity = MaybeWithUnits{<:Real}


DetectorHitEvents = TypedTables.Table{
<:NamedTuple{
(:evtno, :detno, :thit, :edep, :pos),
Expand Down

0 comments on commit 47893c3

Please sign in to comment.