Skip to content

Instantly share code, notes, and snippets.

View cgobat's full-sized avatar
🛰️

Caden Gobat cgobat

🛰️
View GitHub Profile
@cgobat
cgobat / 00_readme.md
Last active March 21, 2024 11:57
Alpine Linux setup tools
@cgobat
cgobat / astro_hq.py
Last active October 11, 2023 16:03
Raspberry Pi setup script for astronomy. Portions from https://github.com/rlancaste/AstroPi3. Run `git clone https://gist.github.com/72d5705e65822a4e06363a444b1d2022.git scripts` to start.
print("This script has moved to https://github.com/cgobat/astro-instruments/blob/main/AstroHQ/astro_hq.py")

Turns a FITS binary table of Gaia DR3 stars with $m_G\leq8$ into a pseudo-tetra3-style database of stars with $m_V\leq7$.

@cgobat
cgobat / stdev_confidence_conversions.py
Created February 9, 2023 00:35
Functions to easily convert between number of sigma (standard deviations) and percent confidence intervals.
# see https://en.wikipedia.org/wiki/68–95–99.7_rule
import numpy as np
from scipy import special
def sigma_to_pct_conf(z: float) -> float:
"""If an uncertainty is ±zσ, what is the corresponding confidence interval?"""
return special.erf(z/np.sqrt(2))
def pct_conf_to_sigma(conf: float) -> float:
@cgobat
cgobat / subprocess.md
Created September 2, 2022 17:44
Python subprocess quick reference guide

Python subprocess quick reference guide

Some methods for running shell commands from within Python, depending on what the expected behavior and desired output are.


Popen

class subprocess.Popen(args, bufsize=- 1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=True, shell=False, cwd=None, env=None, universal_newlines=None, startupinfo=None, creationflags=0, restore_signals=True, start_new_session=False, pass_fds=(), *, group=None, extra_groups=None, user=None, umask=- 1, encoding=None, errors=None, text=None, pipesize=- 1)

@cgobat
cgobat / cspice_exes.py
Last active October 13, 2022 19:19
NAIF CSPICE executable utilities made available within Python
import os, sys, platform
import subprocess
CSPICE_dir = "/absolute/path/to/cspice/"
__doc__ = """
SPICE executables, made available from within Python.
Available executables:
""" + "\n".join([os.path.splitext(exe)[0] for exe in os.listdir(os.path.join(CSPICE_dir,"exe"))]) + """
"""
@cgobat
cgobat / github_intro.pdf
Last active February 24, 2022 01:17
Work-in-progress introduction to GitHub slide deck I created, aimed at peers
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgobat
cgobat / activity recognition.ipynb
Last active February 20, 2022 01:54
Classifying physical activity using smartphone motion data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgobat
cgobat / color_spectra.ipynb
Last active August 16, 2022 19:35
Color stuff with spectra
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cgobat
cgobat / IR_cam.py
Last active February 22, 2024 15:31
Software for Raspberry Pi to capture and overlay data from an AMG8833 infrared thermal camera with images from the RPi optical camera
#######################################################
#
# Thermal camera display for AMG8833 IR camera
#
# by Caden Gobat
# PHYS 2152 | The George Washington University
#
#######################################################
import time, sys