{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "129f639c", "metadata": {}, "outputs": [], "source": [ "import IJulia\n", "\n", "# The julia kernel has built in support for Revise.jl, so this is the \n", "# recommended approach for long-running sessions:\n", "# https://github.com/JuliaLang/IJulia.jl/blob/9b10fa9b879574bbf720f5285029e07758e50a5e/src/kernel.jl#L46-L51\n", "\n", "# Users should enable revise within .julia/config/startup_ijulia.jl:\n", "# https://timholy.github.io/Revise.jl/stable/config/#Using-Revise-automatically-within-Jupyter/IJulia-1\n", "\n", "# clear console history\n", "IJulia.clear_history()\n", "\n", "# Intialize Plots w/ default fig width/height\n", "try\n", " fig_width = 7\n", " fig_height = 5\n", " fig_format = :retina\n", " fig_dpi = 96\n", " # no retina format type, use svg for high quality type/marks\n", " if fig_format == :retina\n", " fig_format = :svg\n", " # IJulia doesn't support PDF output so use png (if the DPI \n", " # remains the default of 300 then set to 96)\n", " elseif fig_format == :pdf\n", " fig_format = :png\n", " fig_dpi = 96\n", " end\n", " # convert inches to pixels\n", " fig_width = fig_width * fig_dpi\n", " fig_height = fig_height * fig_dpi\n", " using Plots\n", " gr(size=(fig_width, fig_height), fmt = fig_format, dpi = fig_dpi)\n", "catch e\n", " # @warn \"Plots init\" exception=(e, catch_backtrace())\n", "end\n", "\n", "# Set run_path if specified\n", "try\n", " run_path = \"\"\n", " if !isempty(run_path)\n", " cd(run_path)\n", " end\n", "catch e\n", " @warn \"Run path init:\" exception=(e, catch_backtrace())\n", "end\n", "\n", "# don't return kernel dependencies (b/c Revise should take care of dependencies)\n", "nothing\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "8b15e8a8", "metadata": {}, "outputs": [], "source": [ "#| code-fold: true\n", "#| output: false\n", "\n", "using FileIO\n", "using MeshIO\n", "\n", "using stlProcess\n", "\n", "using CSV\n", "using DataFrames\n", "\n", "using LinearAlgebra" ] }, { "cell_type": "code", "execution_count": 3, "id": "f40c9594", "metadata": {}, "outputs": [ { "data": { "text/html": [ "

0 rows × 8 columns (omitted printing of 1 columns)

surface_areacharacteristic_lengthsbxsbysbzIxIy
Float64Float64Float64Float64Float64Float64Float64
" ], "text/latex": [ "\\begin{tabular}{r|cccccccc}\n", "\t& surface\\_area & characteristic\\_length & sbx & sby & sbz & Ix & Iy & \\\\\n", "\t\\hline\n", "\t& Float64 & Float64 & Float64 & Float64 & Float64 & Float64 & Float64 & \\\\\n", "\t\\hline\n", "\\end{tabular}\n" ], "text/plain": [ "\u001b[1m0×8 DataFrame\u001b[0m" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "#| code-fold: true\n", "#| output: false\n", "\n", "# local path to https://gitlab.com/orbital-debris-research/fake-satellite-dataset\n", "dataset_path = raw\"C:\\Coding\\fake-satellite-dataset\"\n", "\n", "folders = [\"1_5U\", \"assembly1\", \"cubesat\"]\n", "\n", "df = DataFrame(;\n", " surface_area=Float64[],\n", " characteristic_length=Float64[],\n", " sbx=Float64[],\n", " sby=Float64[],\n", " sbz=Float64[],\n", " Ix=Float64[],\n", " Iy=Float64[],\n", " Iz=Float64[],\n", ")" ] }, { "cell_type": "code", "execution_count": 4, "id": "bb8f7086", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Processing Path: C:\\Coding\\fake-satellite-dataset\\1_5U\n", "Processing Path: C:\\Coding\\fake-satellite-dataset\\assembly1\n", "Processing Path: C:\\Coding\\fake-satellite-dataset\\cubesat\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "┌ Warning: Characteristic Length Algorithm failed to converge, this usually means stl is flat. Setting length in dir to 0.\n", "└ @ stlProcess C:\\Users\\albig\\.julia\\packages\\stlProcess\\8rsc7\\src\\stlProcess.jl:153\n" ] } ], "source": [ "for path in dataset_path * \"\\\\\" .* folders\n", " println(\"Processing Path: \", path)\n", " Threads.@threads for file in readdir(path)\n", " stl = load(path * \"\\\\\" * file)\n", " scale = find_scale(stl)\n", " props = get_mass_properties(stl; scale=scale)\n", "\n", " eigs = eigvals(props.inertia)\n", " sort_index = sortperm(eigs)\n", " Ix, Iy, Iz = eigs[sort_index]\n", " sbx, sby, sbz = props.sb_values[sort_index]\n", "\n", " push!(\n", " df,\n", " [props.surface_area, props.characteristic_length, sbx, sby, sbz, Ix, Iy, Iz],\n", " )\n", " end\n", "end" ] }, { "cell_type": "code", "execution_count": 5, "id": "a51a601f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "

8 rows × 7 columns

variablemeanminmedianmaxnmissingeltype
SymbolFloat64Float64Float64Float64Int64DataType
1surface_area25.20025.6086513.3338159.4060Float64
2characteristic_length79.54810.1585211.558161582.230Float64
3sbx1.402220.04173670.96707810.06630Float64
4sby3.33670.01258242.684619.683610Float64
5sbz3.911840.290061.818514.74340Float64
6Ix1.587250.03117820.2340111.13350Float64
7Iy3.743450.1785981.0159224.67350Float64
8Iz5.202070.1786861.74232.00830Float64
" ], "text/latex": [ "\\begin{tabular}{r|ccccccc}\n", "\t& variable & mean & min & median & max & nmissing & eltype\\\\\n", "\t\\hline\n", "\t& Symbol & Float64 & Float64 & Float64 & Float64 & Int64 & DataType\\\\\n", "\t\\hline\n", "\t1 & surface\\_area & 25.2002 & 5.60865 & 13.3338 & 159.406 & 0 & Float64 \\\\\n", "\t2 & characteristic\\_length & 79.5481 & 0.158521 & 1.55816 & 1582.23 & 0 & Float64 \\\\\n", "\t3 & sbx & 1.40222 & 0.0417367 & 0.967078 & 10.0663 & 0 & Float64 \\\\\n", "\t4 & sby & 3.3367 & 0.0125824 & 2.68461 & 9.68361 & 0 & Float64 \\\\\n", "\t5 & sbz & 3.91184 & 0.29006 & 1.8185 & 14.7434 & 0 & Float64 \\\\\n", "\t6 & Ix & 1.58725 & 0.0311782 & 0.23401 & 11.1335 & 0 & Float64 \\\\\n", "\t7 & Iy & 3.74345 & 0.178598 & 1.01592 & 24.6735 & 0 & Float64 \\\\\n", "\t8 & Iz & 5.20207 & 0.178686 & 1.742 & 32.0083 & 0 & Float64 \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "\u001b[1m8×7 DataFrame\u001b[0m\n", "\u001b[1m Row \u001b[0m│\u001b[1m variable \u001b[0m\u001b[1m mean \u001b[0m\u001b[1m min \u001b[0m\u001b[1m median \u001b[0m\u001b[1m max \u001b[0m\u001b[1m nmis\u001b[0m ⋯\n", "\u001b[1m \u001b[0m│\u001b[90m Symbol \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Float64 \u001b[0m\u001b[90m Int6\u001b[0m ⋯\n", "─────┼──────────────────────────────────────────────────────────────────────────\n", " 1 │ surface_area 25.2002 5.60865 13.3338 159.406 ⋯\n", " 2 │ characteristic_length 79.5481 0.158521 1.55816 1582.23\n", " 3 │ sbx 1.40222 0.0417367 0.967078 10.0663\n", " 4 │ sby 3.3367 0.0125824 2.68461 9.68361\n", " 5 │ sbz 3.91184 0.29006 1.8185 14.7434 ⋯\n", " 6 │ Ix 1.58725 0.0311782 0.23401 11.1335\n", " 7 │ Iy 3.74345 0.178598 1.01592 24.6735\n", " 8 │ Iz 5.20207 0.178686 1.742 32.0083\n", "\u001b[36m 2 columns omitted\u001b[0m" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "describe(df)" ] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.8.0-beta3", "language": "julia", "name": "julia-1.8" } }, "nbformat": 4, "nbformat_minor": 5 }