Skip to content

Instantly share code, notes, and snippets.

View luisdamed's full-sized avatar

Luis Medina luisdamed

View GitHub Profile
@luisdamed
luisdamed / matlab_time_series_plot.m
Last active August 1, 2022 19:00
Matlab code to plot time series data from a csv file
%% Read the CSV file
filename = 'test_FSCar_ddMMYYYY_TrackN_setupID2.csv'
t = readtable(filename);
%% Index non-empty values and extract time vector
idx1 = ~isnan(t.spd_rpmFL);
idx2 = ~isnan(t.spd_rpmFR);
idx3 = ~isnan(t.trq_NmFL);
@luisdamed
luisdamed / python_time_series_plot.py
Last active August 20, 2022 06:54
Python script example for plotting time series data from a csv file
#%% Import libraries and read file as dataframe
import pandas as pd
import numpy as np
df = pd.read_csv('test_FSCar_ddMMYYYY_TrackN_setupID2.csv')
#%% Index non-empty values and extract time vector
idx1 = df.spd_rpmFL.notnull()
idx2 = df.spd_rpmFR.notnull()
@luisdamed
luisdamed / histograms_comparison.py
Last active August 12, 2022 14:39
Compare histograms of different data series by creating bar charts and adding some descriptive statistics to the figure
import pandas as pd
df = pd.read_csv('test_FSCar_ddMMYYYY_TrackN_setupID2.csv')
# Get statistics
meanFL = df.trq_NmFL.mean()
meanFR = df.trq_NmFR.mean()
meanRL = df.trq_NmRL.mean()
meanRR = df.trq_NmRR.mean()
stdFL = df.trq_NmFL.std()
@luisdamed
luisdamed / histograms_comparison.m
Last active August 12, 2022 14:38
Compare histograms of different data series from a CSV file by creating a bar chart and adding some text with descriptive statistics to the figure. Works with 2020a
%% Read the CSV file
filename = 'test_FSCar_ddMMYYYY_TrackN_setupID2.csv'
t = readtable(filename);
%% Get statistics
meanFL = mean(t.trq_NmFL, 'omitnan')
meanFR = mean(t.trq_NmFR, 'omitnan')
meanRL = mean(t.trq_NmRL, 'omitnan')
meanRR = mean(t.trq_NmRR, 'omitnan')
stdFL = std(t.trq_NmFL, 'omitnan')
@luisdamed
luisdamed / Thingiverse_API_runner.py
Last active April 15, 2024 04:52
Collect data from Thingiverse.com REST API. You need to get an authorization token in order to use it - it is free.
#%% Thingiverse_API_runner
# Import libraries and make a first request to get the data about the different categories
from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
import pandas as pd
pd.set_option('display.max_columns', None)
my_token = 'get yours at https://www.thingiverse.com/developers'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luisdamed
luisdamed / PieChart_Python_Pygal_Thingiverse_Categories_Condensed.svg
Created March 3, 2023 05:35
Summary of the distribution of likes, makes and number of models for different categories of Thingiverse, as of October 2022
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luisdamed
luisdamed / PieChart_Python_Pygal_Thingiverse_Proportion_Makes_vs_Things.svg
Created March 3, 2023 05:41
Pie chart showing the average number of makes for the models in each category of Thingiverse as of October 2022
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
<html>
<head><meta charset="utf-8" /></head>
<body>
<div> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>
<script type="text/javascript">/**
* plotly.js v2.14.0
* Copyright 2012-2022, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
This file has been truncated, but you can view the full file.
<html>
<head><meta charset="utf-8" /></head>
<body>
<script type="text/javascript">!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}((function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,(function(t){return i(e[o][1][t]||t)}),u,u.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";var n=t("plotly.js/src/components/annotations"),i=t("plotly.js");n.add=function(t){var e=t._fullLayout.annotations.length;i.relayout(t,"annotations["+e+"]","ad