code to process data before matlab

This commit is contained in:
Anson 2022-02-13 15:15:44 -07:00
parent 43ee4f4994
commit 259a133f11
4 changed files with 1266 additions and 0 deletions

1155
prep/Manifest.toml Normal file

File diff suppressed because it is too large Load Diff

6
prep/Project.toml Normal file
View File

@ -0,0 +1,6 @@
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DataFramesMeta = "1313f7d8-7da2-5740-9ea0-a2ca25f37964"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"

60
prep/prep.jl Normal file
View File

@ -0,0 +1,60 @@
using DataFrames
using LinearAlgebra
using CSV
using DataFramesMeta
using Plots
using StatsPlots
begin
df = CSV.read("compiled.csv", DataFrame)
df.bb_volume = df.bb_length .* df.bb_width .* df.bb_height
@eachrow! df begin
@newcol :Ix::Vector{Float64}
@newcol :Iy::Vector{Float64}
@newcol :Iz::Vector{Float64}
@newcol :Ibar::Vector{Float64}
I = [
:Ixx :Ixy :Ixz
:Iyx :Iyy :Iyz
:Izx :Izy :Izz
]
(:Ix, :Iy, :Iz) = eigvals(I)
:Ibar = :Ix^2 + :Iy^2 + :Iz^2 |> sqrt
end
# Convert material to scalar
begin
kv = Dict(reverse.(enumerate(Set(df.material_name))))
mats = []
for material in df.material_name
push!(mats, kv[material])
end
df.material_index = mats
end
# Remove columns not needed for analysis
df = df[!, [:mass, :volume, :density, :area, :bb_volume, :Ibar]]
# Remove outliers
df = df[df.bb_volume.<1e6, :]
df = df[df.mass.<1000, :]
end
@df df cornerplot(cols(1:4), compact = true)
# plot(df.mass)
# histogram(df.mass)
scatter(df.mass, df.volume)
CSV.write("prepped.csv", df)

45
prepped.csv Normal file
View File

@ -0,0 +1,45 @@
mass,volume,density,area,bb_volume,Ibar
1.066,995.9,0.001,2069.301,7176.96,153.72874402012403
108.079,13768.029,0.008,19215.837,40069.26,207734.78101312218
433.406,55210.971,0.008,57969.555,210407.28048000002,683995.5502520726
0.847,108.651,0.008,274.826,1081.5593375840003,14.168204014623734
238.488,30380.637,0.008,36346.664,67608.51299999999,1.3486211992376125e6
11.338,1444.311,0.008,1210.691,2211.0,1738.215640169539
11.338,1444.311,0.008,1210.691,2211.0,1738.215640169539
51.926,19232.035,0.003,5129.026,41817.6,12690.25031274084
3.615,460.535,0.008,1181.069,5533.789063138,445.2408284299633
51.926,19232.035,0.003,5129.026,41817.6,12690.25031274084
238.488,30380.637,0.008,36346.664,67608.51299999999,1.3486211992376125e6
141.036,17966.31,0.008,33980.334,860155.86,314358.9114140484
12.203,1554.512,0.008,2351.908,2936.6708,690.0074899607974
12.203,1554.512,0.008,2351.908,2936.6708,690.0074899607974
238.488,30380.637,0.008,36346.664,67608.51299999999,1.3486211992376125e6
365.628,46576.871,0.008,55492.134,103890.15,4.701074854900372e6
58.053,7395.244,0.008,2990.011,10164.0,42239.105195730794
51.926,19232.035,0.003,5129.026,41817.6,12690.250312740842
4.211,536.42,0.008,874.34,1860.2788,402.35623195745336
133.418,16995.941,0.008,30952.471,72293.1,90508.51809910338
1.066,995.9,0.001,2069.301,7176.96,153.72874402012403
20.543,2633.756,0.008,6078.184,53128.416,8520.54886629764
238.488,30380.637,0.008,36346.664,67608.51299999999,1.3486211992376125e6
11.338,1444.311,0.008,1210.691,2211.0,1738.215640169539
11.338,1444.311,0.008,1210.691,2211.0,1738.215640169539
11.338,1444.311,0.008,1210.691,2211.0,1738.215640169539
0.847,108.651,0.008,274.826,1081.5593375840003,14.168204014623734
46.103,5872.947,0.008,13143.977,47481.0,16394.45274151644
238.488,30380.637,0.008,36346.664,67608.51299999999,1.3486211992376125e6
58.053,7395.244,0.008,2990.011,10164.0,42239.105195730794
0.847,108.651,0.008,274.826,1081.5593375840003,14.168204014623734
9.266,3431.699,0.003,3369.751,5062.5,3063.7696834076805
141.036,17966.31,0.008,33980.334,860155.86,314358.9114140484
365.628,46576.871,0.008,55492.134,103890.15,4.701074854900372e6
58.053,7395.244,0.008,2990.011,10164.0,42239.105195730794
11.338,1444.311,0.008,1210.691,2211.0,1738.215640169539
505.292,64368.346,0.008,9976.414,67240.0,233826.99232060715
365.638,46578.15,0.008,74736.144,205264.512,584912.3744381818
108.079,13768.029,0.008,19215.837,40069.26,207734.78101312218
0.0,12245.003,0.0,18268.074,234646.24052758503,0.0
238.488,30380.637,0.008,36346.664,67608.51299999999,1.3486211992376125e6
249.853,31828.4,0.008,7087.864,45938.0,88826.10011105421
317.415,56671.244,0.006,46801.002,342330.694810351,390547.77702129295
0.847,108.651,0.008,274.826,1081.5593375840003,14.168204014623734
1 mass volume density area bb_volume Ibar
2 1.066 995.9 0.001 2069.301 7176.96 153.72874402012403
3 108.079 13768.029 0.008 19215.837 40069.26 207734.78101312218
4 433.406 55210.971 0.008 57969.555 210407.28048000002 683995.5502520726
5 0.847 108.651 0.008 274.826 1081.5593375840003 14.168204014623734
6 238.488 30380.637 0.008 36346.664 67608.51299999999 1.3486211992376125e6
7 11.338 1444.311 0.008 1210.691 2211.0 1738.215640169539
8 11.338 1444.311 0.008 1210.691 2211.0 1738.215640169539
9 51.926 19232.035 0.003 5129.026 41817.6 12690.25031274084
10 3.615 460.535 0.008 1181.069 5533.789063138 445.2408284299633
11 51.926 19232.035 0.003 5129.026 41817.6 12690.25031274084
12 238.488 30380.637 0.008 36346.664 67608.51299999999 1.3486211992376125e6
13 141.036 17966.31 0.008 33980.334 860155.86 314358.9114140484
14 12.203 1554.512 0.008 2351.908 2936.6708 690.0074899607974
15 12.203 1554.512 0.008 2351.908 2936.6708 690.0074899607974
16 238.488 30380.637 0.008 36346.664 67608.51299999999 1.3486211992376125e6
17 365.628 46576.871 0.008 55492.134 103890.15 4.701074854900372e6
18 58.053 7395.244 0.008 2990.011 10164.0 42239.105195730794
19 51.926 19232.035 0.003 5129.026 41817.6 12690.250312740842
20 4.211 536.42 0.008 874.34 1860.2788 402.35623195745336
21 133.418 16995.941 0.008 30952.471 72293.1 90508.51809910338
22 1.066 995.9 0.001 2069.301 7176.96 153.72874402012403
23 20.543 2633.756 0.008 6078.184 53128.416 8520.54886629764
24 238.488 30380.637 0.008 36346.664 67608.51299999999 1.3486211992376125e6
25 11.338 1444.311 0.008 1210.691 2211.0 1738.215640169539
26 11.338 1444.311 0.008 1210.691 2211.0 1738.215640169539
27 11.338 1444.311 0.008 1210.691 2211.0 1738.215640169539
28 0.847 108.651 0.008 274.826 1081.5593375840003 14.168204014623734
29 46.103 5872.947 0.008 13143.977 47481.0 16394.45274151644
30 238.488 30380.637 0.008 36346.664 67608.51299999999 1.3486211992376125e6
31 58.053 7395.244 0.008 2990.011 10164.0 42239.105195730794
32 0.847 108.651 0.008 274.826 1081.5593375840003 14.168204014623734
33 9.266 3431.699 0.003 3369.751 5062.5 3063.7696834076805
34 141.036 17966.31 0.008 33980.334 860155.86 314358.9114140484
35 365.628 46576.871 0.008 55492.134 103890.15 4.701074854900372e6
36 58.053 7395.244 0.008 2990.011 10164.0 42239.105195730794
37 11.338 1444.311 0.008 1210.691 2211.0 1738.215640169539
38 505.292 64368.346 0.008 9976.414 67240.0 233826.99232060715
39 365.638 46578.15 0.008 74736.144 205264.512 584912.3744381818
40 108.079 13768.029 0.008 19215.837 40069.26 207734.78101312218
41 0.0 12245.003 0.0 18268.074 234646.24052758503 0.0
42 238.488 30380.637 0.008 36346.664 67608.51299999999 1.3486211992376125e6
43 249.853 31828.4 0.008 7087.864 45938.0 88826.10011105421
44 317.415 56671.244 0.006 46801.002 342330.694810351 390547.77702129295
45 0.847 108.651 0.008 274.826 1081.5593375840003 14.168204014623734