Skip to content

Instantly share code, notes, and snippets.

View maxnoe's full-sized avatar

Maximilian Linhoff maxnoe

  • TU Dortmund
  • Germany
View GitHub Profile
@maxnoe
maxnoe / download_seafile.py
Last active February 17, 2022 09:39
Download shared directory from a seafile server
#!/usr/bin/env python
'''
Download files from a password protected seafile share.
Converted to use python from https://gist.github.com/vmx/ed6f91b93bc3c4f7e152dcd5f377ecef
'''
import requests
from argparse import ArgumentParser
import logging
from urllib.parse import urlparse
from pathlib import Path
@maxnoe
maxnoe / cauchy_normal_ani.ipynb
Created May 19, 2021 10:05
Cauchy and Normal Distribution Sample Mean and Std Dev Animation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maxnoe
maxnoe / hipparcos_uncertainties.ipynb
Last active April 27, 2021 09:05
hipparcos proper motion uncertainties
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maxnoe
maxnoe / environment.yml
Last active June 11, 2021 10:21
Perseverance flight to Mars animated using matplotlib / astropy / astroquery
name: eschool2021
channels:
- default
- conda-forge
dependencies:
- astropy=4.2
- numpy=1.20
- matplotlib=3.4
- astroquery
- jupyter
@maxnoe
maxnoe / plot_cosmic_rays.py
Created December 5, 2019 09:49
Plot data files from https://lpsc.in2p3.fr/cosmic-rays-db without unpacking the tarball
import tarfile
import pandas as pd
from io import TextIOWrapper
import matplotlib.pyplot as plt
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('outputfile')
@maxnoe
maxnoe / plot_mjd_secondary.py
Last active April 21, 2021 10:45
Plotting a secondary MJD date axis with matplotlib ≥ 3.1
import matplotlib.pyplot as plt
import numpy as np
from astropy.time import Time
import astropy.units as u
t = Time.now() + np.linspace(0, 30, 30) * u.day
# plot something vs time normally using a list of datetimes as x values
fig, ax = plt.subplots(constrained_layout=True)
@maxnoe
maxnoe / header-matplotlib.tex
Last active August 17, 2018 10:51
Graphic explaining the hillas features in Imaging Air Cherenkov Astronomy
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{fontspec}
\usepackage{xcolor}
\setmainfont[BoldFont=Akkurat Office]{Akkurat Light Office}
\setsansfont[BoldFont=Akkurat Office]{Akkurat Light Office}
\setmonofont[BoldFont=Fira Code, Scale=MatchLowercase]{Fira Code Light}
\usepackage[
math-style=ISO,
@maxnoe
maxnoe / muon_lifetime_fits.py
Last active June 22, 2021 09:03
Fitting histograms of muon lifetimes. Do not estimate weights from your data!
import numpy as np
from scipy.optimize import curve_fit, minimize
import matplotlib.pyplot as plt
from tqdm import tqdm
from scipy.stats import poisson
MUON_LIFETIME = 2.196_981_1
bins = np.linspace(0.5, 12, 150)
@maxnoe
maxnoe / download_gutenberg.py
Last active May 27, 2024 21:00
Download html and images from gutenberg.spiegel.de and convert to ebooks
import requests
from bs4 import BeautifulSoup
from argparse import ArgumentParser
import subprocess as sp
import tempfile
import os
from multiprocessing.pool import ThreadPool
import json
import logging
import re
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.