mirror of
https://gitlab.com/orbital-debris-research/directed-study/report-1.git
synced 2025-07-25 23:51:29 +00:00
code to process data before matlab
This commit is contained in:
1155
prep/Manifest.toml
Normal file
1155
prep/Manifest.toml
Normal file
File diff suppressed because it is too large
Load Diff
6
prep/Project.toml
Normal file
6
prep/Project.toml
Normal 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
60
prep/prep.jl
Normal 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)
|
Reference in New Issue
Block a user