generated from mmistakes/mm-github-pages-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba74e15
commit ef12fa2
Showing
8 changed files
with
9,594 additions
and
1 deletion.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<div> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script> | ||
<script charset="utf-8" src="https://cdn.plot.ly/plotly-2.20.0.min.js"></script> <div id="6abb406a-0097-46d3-a4e5-2f0296d930c0" class="plotly-graph-div" style="height:400px; width:1200px;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("6abb406a-0097-46d3-a4e5-2f0296d930c0")) { Plotly.newPlot( "6abb406a-0097-46d3-a4e5-2f0296d930c0", [{"fill":"tozeroy","name":"LiDAR scans","x":["2023-11-14 20:42:36.968173","2024-02-08 20:47:58.240025"],"y":[70,218],"type":"scatter","xaxis":"x","yaxis":"y"},{"fill":"tozeroy","name":"Cones","x":["2023-11-14 20:42:36.968173","2024-02-08 20:47:58.240025"],"y":[3487,9235],"type":"scatter","xaxis":"x2","yaxis":"y2"}], {"template":{"data":{"barpolar":[{"marker":{"line":{"color":"rgb(17,17,17)","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"barpolar"}],"bar":[{"error_x":{"color":"#f2f5fa"},"error_y":{"color":"#f2f5fa"},"marker":{"line":{"color":"rgb(17,17,17)","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"bar"}],"carpet":[{"aaxis":{"endlinecolor":"#A2B1C6","gridcolor":"#506784","linecolor":"#506784","minorgridcolor":"#506784","startlinecolor":"#A2B1C6"},"baxis":{"endlinecolor":"#A2B1C6","gridcolor":"#506784","linecolor":"#506784","minorgridcolor":"#506784","startlinecolor":"#A2B1C6"},"type":"carpet"}],"choropleth":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"choropleth"}],"contourcarpet":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"contourcarpet"}],"contour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"contour"}],"heatmapgl":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"heatmapgl"}],"heatmap":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"heatmap"}],"histogram2dcontour":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2dcontour"}],"histogram2d":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"histogram2d"}],"histogram":[{"marker":{"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"histogram"}],"mesh3d":[{"colorbar":{"outlinewidth":0,"ticks":""},"type":"mesh3d"}],"parcoords":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"parcoords"}],"pie":[{"automargin":true,"type":"pie"}],"scatter3d":[{"line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatter3d"}],"scattercarpet":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattercarpet"}],"scattergeo":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattergeo"}],"scattergl":[{"marker":{"line":{"color":"#283442"}},"type":"scattergl"}],"scattermapbox":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scattermapbox"}],"scatterpolargl":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolargl"}],"scatterpolar":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterpolar"}],"scatter":[{"marker":{"line":{"color":"#283442"}},"type":"scatter"}],"scatterternary":[{"marker":{"colorbar":{"outlinewidth":0,"ticks":""}},"type":"scatterternary"}],"surface":[{"colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"type":"surface"}],"table":[{"cells":{"fill":{"color":"#506784"},"line":{"color":"rgb(17,17,17)"}},"header":{"fill":{"color":"#2a3f5f"},"line":{"color":"rgb(17,17,17)"}},"type":"table"}]},"layout":{"annotationdefaults":{"arrowcolor":"#f2f5fa","arrowhead":0,"arrowwidth":1},"autotypenumbers":"strict","coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]],"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]},"colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#f2f5fa"},"geo":{"bgcolor":"rgb(17,17,17)","lakecolor":"rgb(17,17,17)","landcolor":"rgb(17,17,17)","showlakes":true,"showland":true,"subunitcolor":"#506784"},"hoverlabel":{"align":"left"},"hovermode":"closest","mapbox":{"style":"dark"},"paper_bgcolor":"rgb(17,17,17)","plot_bgcolor":"rgb(17,17,17)","polar":{"angularaxis":{"gridcolor":"#506784","linecolor":"#506784","ticks":""},"bgcolor":"rgb(17,17,17)","radialaxis":{"gridcolor":"#506784","linecolor":"#506784","ticks":""}},"scene":{"xaxis":{"backgroundcolor":"rgb(17,17,17)","gridcolor":"#506784","gridwidth":2,"linecolor":"#506784","showbackground":true,"ticks":"","zerolinecolor":"#C8D4E3"},"yaxis":{"backgroundcolor":"rgb(17,17,17)","gridcolor":"#506784","gridwidth":2,"linecolor":"#506784","showbackground":true,"ticks":"","zerolinecolor":"#C8D4E3"},"zaxis":{"backgroundcolor":"rgb(17,17,17)","gridcolor":"#506784","gridwidth":2,"linecolor":"#506784","showbackground":true,"ticks":"","zerolinecolor":"#C8D4E3"}},"shapedefaults":{"line":{"color":"#f2f5fa"}},"sliderdefaults":{"bgcolor":"#C8D4E3","bordercolor":"rgb(17,17,17)","borderwidth":1,"tickwidth":0},"ternary":{"aaxis":{"gridcolor":"#506784","linecolor":"#506784","ticks":""},"baxis":{"gridcolor":"#506784","linecolor":"#506784","ticks":""},"bgcolor":"rgb(17,17,17)","caxis":{"gridcolor":"#506784","linecolor":"#506784","ticks":""}},"title":{"x":0.05},"updatemenudefaults":{"bgcolor":"#506784","borderwidth":0},"xaxis":{"automargin":true,"gridcolor":"#283442","linecolor":"#506784","ticks":"","title":{"standoff":15},"zerolinecolor":"#283442","zerolinewidth":2},"yaxis":{"automargin":true,"gridcolor":"#283442","linecolor":"#506784","ticks":"","title":{"standoff":15},"zerolinecolor":"#283442","zerolinewidth":2}}},"xaxis":{"anchor":"y","domain":[0.0,0.45],"tickformat":"%B %Y"},"yaxis":{"anchor":"x","domain":[0.0,1.0]},"xaxis2":{"anchor":"y2","domain":[0.55,1.0],"tickformat":"%B %Y"},"yaxis2":{"anchor":"x2","domain":[0.0,1.0]},"title":{"text":"Contribution history"},"width":1200,"height":400,"paper_bgcolor":"rgba(0,0,0,0)","plot_bgcolor":"rgba(0,0,0,0)"}, {"responsive": true} ) }; </script> </div> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import os | ||
import pandas as pd | ||
|
||
# Path to the directory containing the scene files | ||
scene_dir = '/Users/bertaveira/Documents/CFS/dv/CFS_dataset/awesome_dataset' | ||
|
||
# Open existing csv file | ||
df = pd.read_csv(os.path.join(os.getcwd(),'tools', 'coneScenes_stats.csv')) | ||
|
||
# Convert the 'Date' column to datetime | ||
df['Date'] = pd.to_datetime(df['Date']) | ||
current_num_scans = df['NumScans'].iloc[-1] | ||
current_num_new_cones = df['NumNewCones'].iloc[-1] | ||
|
||
# Get all txt files in the scene directory | ||
label_files = [os.path.join(scene_dir, 'labels', f) for f in os.listdir(os.path.join(scene_dir, 'labels')) if f.endswith('.txt')] | ||
num_scans = len(label_files) | ||
|
||
num_new_cones = 0 | ||
distribution = [] | ||
for label_file in label_files: | ||
# Open the label file | ||
with open(label_file, 'r') as f: | ||
# Count number of non empty lines | ||
# Read first 3 numbers of each line | ||
for line in f: | ||
if line.strip() != '': | ||
num_new_cones += 1 | ||
|
||
numbers = line.split(' ') | ||
# Compute euclidean distance in 3d | ||
|
||
if numbers[0] == '0' and numbers[1] == '0' and numbers[2] == '0': | ||
print(f"Skipping cone at origin: {label_file}") | ||
continue | ||
|
||
distribution.append((float(numbers[0]), float(numbers[1]), (float(numbers[0]) ** 2 + float(numbers[1]) ** 2 + float(numbers[2]) ** 2) ** 0.5)) | ||
|
||
# Add new row to the dataframe with current date and number of new cones | ||
new_row = { | ||
'Date': pd.to_datetime('today'), | ||
'NumScans': current_num_scans + num_scans, | ||
'NumNewCones': current_num_new_cones + num_new_cones | ||
} | ||
|
||
print(f"New row: {new_row}") | ||
|
||
df = pd.concat([df, pd.DataFrame(new_row, index=[0])], ignore_index=True) | ||
|
||
# Save the updated dataframe to the csv file | ||
df.to_csv(os.path.join('tools', 'coneScenes_stats.csv'), index=False) | ||
|
||
# Append to distribution csv | ||
csv_file = os.path.join('tools', 'coneScenes_distribution.csv') | ||
distribution_df = pd.DataFrame(distribution) | ||
distribution_df.columns = ['X', 'Y', 'Distance'] | ||
|
||
distribution_df = pd.concat([pd.read_csv(csv_file), distribution_df], ignore_index=True) | ||
distribution_df.to_csv(os.path.join('tools', 'coneScenes_distribution.csv'), index=False, float_format='%.1f') | ||
|
||
# Distribution plot | ||
# import plotly.express as px | ||
|
||
# fig = px.histogram(distribution_df, x=0, histnorm='density', title='Distribution of cone distances', template='plotly_white') | ||
# fig.update_layout(width=800, height=400) | ||
# fig.update_xaxes(title_text='Distance (m)') | ||
# fig.update_yaxes(title_text='Count') | ||
# fig.show() | ||
|
||
import numpy as np | ||
import plotly.figure_factory as ff | ||
import plotly.express as px | ||
|
||
pos = np.array(distribution) | ||
x, y = pos[:, 0], pos[:, 1] | ||
|
||
import plotly.graph_objects as go | ||
|
||
import numpy as np | ||
|
||
fig = go.Figure() | ||
fig.add_trace(go.Histogram2dContour( | ||
x = y, | ||
y = x, | ||
colorscale = 'Blues', | ||
reversescale = True, | ||
xaxis = 'y', | ||
yaxis = 'y' | ||
)) | ||
fig.add_trace(go.Histogram( | ||
y = x, | ||
xaxis = 'x2', | ||
marker = dict( | ||
color = 'rgba(0,0,0,1)' | ||
) | ||
)) | ||
fig.add_trace(go.Histogram( | ||
x = y, | ||
yaxis = 'y2', | ||
marker = dict( | ||
color = 'rgba(0,0,0,1)' | ||
) | ||
)) | ||
|
||
fig.update_layout( | ||
autosize = False, | ||
xaxis = dict( | ||
zeroline = False, | ||
domain = [0,0.85], | ||
showgrid = False | ||
), | ||
yaxis = dict( | ||
zeroline = False, | ||
domain = [0,0.85], | ||
showgrid = False | ||
), | ||
xaxis2 = dict( | ||
zeroline = False, | ||
domain = [0.85,1], | ||
showgrid = False | ||
), | ||
yaxis2 = dict( | ||
zeroline = False, | ||
domain = [0.85,1], | ||
showgrid = False | ||
), | ||
height = 600, | ||
width = 600, | ||
bargap = 0, | ||
hovermode = 'closest', | ||
showlegend = False | ||
) | ||
|
||
fig.show() |
Oops, something went wrong.