Skip to content

Instantly share code, notes, and snippets.

@SquidSinker
Last active June 30, 2022 15:36
Show Gist options
  • Save SquidSinker/6b8816b599e5d11cc19eef2a0c633620 to your computer and use it in GitHub Desktop.
Save SquidSinker/6b8816b599e5d11cc19eef2a0c633620 to your computer and use it in GitHub Desktop.
OpticalRotationSim.jl
concs = collect(0.01:0.01:0.1)
# concerr = []
# volerr = 0.5
# for conc in concs
# mass = conc*100
# masserrperc = 0.1/mass
# push!(concerr, (masserrperc+volerr/100)*conc)
# end
# specificrotations = [111, 79.9, 71.3, 46, 41.8]
# length = 16.85
# lengtherrd = Normal(0,0.01/2.326)
# wavelengthrotations = Dict()
function sim(concs::Array, specificrotations::Array, length::Number, lengtherr::Number, volerr::Number)
wavelengthrotations = Dict()
concerr = []
for conc in concs
mass = conc*100
masserrperc = 0.1/mass
push!(concerr, (masserrperc+volerr/100)*conc)
end
lengtherrd = Normal(0, lengtherr/2.326)
for rotation in specificrotations
obsrotations = []
for i in 1:size(concs)[1]
concerrd = Normal(0, concerr[i]/2.326)
push!(obsrotations, rotation*(concs[i]+rand(concerrd)*(length + rand(lengtherrd))))
end
wavelengthrotations[rotation] = obsrotations
end
return wavelengthrotations
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment