From 5334e3f8f5828bd056c303566a25c7b6fd665739 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Wed, 30 Mar 2022 22:28:47 +0200 Subject: [PATCH] Small fixes --- Day_3/Day_3.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Day_3/Day_3.jl b/Day_3/Day_3.jl index 5ad3803..50430bc 100644 --- a/Day_3/Day_3.jl +++ b/Day_3/Day_3.jl @@ -127,7 +127,7 @@ df2[0.15 .< df2.B .< 0.2, :] df2[(0.15 .< df2.B .< 0.2) .|| (df2.B .> 0.97), :] # ╔═╡ 403e40d1-87ba-4847-951f-be7bca058573 -# Replace all table enteries having the value 100 with 42 +# Replace all table entries having the value 100 with 42 replace!(df2.A, 100 => 42) # ╔═╡ 44dd5cb6-0ad9-443a-ba48-fa551d8971b4 @@ -135,7 +135,7 @@ replace!(df2.A, 100 => 42) last(df2, 3) # ╔═╡ 53c09851-b6a8-4e1e-abfb-9b1b7bc991e1 -# More flexiblity using `replace!` +# More flexibility using `replace!` replace!(df2.A) do x # Anonymous function if isodd(x) @@ -330,7 +330,8 @@ end # Usually, you should not copy code! 😯 # There is a better way of handling this redefinition without much copying. -# But this code improvement was not done to avoid complication at this point. +# The most elegant way would be to define a macro that rewrites your function and adds the two exclamation marks. +# But this code improvement was not done to avoid unneeded complexity at this point. # ╔═╡ 5280cdc2-bfcf-4c38-85f2-6134aa95d679 # How to use the custom scattering function @@ -454,7 +455,7 @@ Again, you can automate this process! """ # ╔═╡ ef6274cf-f1fb-4f86-becf-eeb181ed92fc -function automated_fit(model, df, x_column_name, y_column_name, p0=[1.0, 1.0]) +function automated_fit(model, df, x_column_name, y_column_name, p0) fit = curve_fit( model, ustrip.(Measurements.value.(df[!, x_column_name])), @@ -475,6 +476,7 @@ param2, sigma2 = automated_fit( df_I_B_with_err, "I", "B", + p0 ) # ╔═╡ 00000000-0000-0000-0000-000000000001