Skip to content

Instantly share code, notes, and snippets.

View Cadair's full-sized avatar

Stuart Mumford Cadair

View GitHub Profile
// Input is data object which is hook body
// Output is result variable of form
// {
// "version": "v2" // The version of the schema being returned from the function. This is always "v2".
// "empty": true|false, // Should the webhook be ignored and no output returned. The default is false (plain must be provided).
// "plain": "Some text", // The plaintext value to be used for the Matrix message.
// "html": "<b>Some</b> text", // The HTML value to be used for the Matrix message. If not provided, plain will be interpreted as markdown.
// "msgtype": "some.type", // The message type, such as m.notice or m.text, to be used for the Matrix message. If not provided, m.notice will be used.
// }
import os
os.environ["QT_QPA_PLATFORM"] = "wayland"
from tqdm import tqdm
from pathlib import Path
from itertools import groupby
import numpy as np
import sunpy.map
from sunpy.coordinates import Helioprojective
from pathlib import Path
import matplotlib.pyplot as plt
import astropy.units as u
import dkist
from dkist.net import transfer_complete_datasets
plt.ion()
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
import sunpy.map
from astropy.coordinates import SkyCoord
from matplotlib.animation import FuncAnimation
from sunpy.coordinates import RotatedSunFrame
from sunpy.coordinates.utils import GreatArc
from sunpy.net import Fido
from sunpy.net import attrs as a
import astropy.units as u
from astropy.coordinates import SkyCoord, SkyOffsetFrame
import sunpy.coordinates
import sunpy.map
from sunpy.data.sample import AIA_171_IMAGE
import matplotlib.pyplot as plt
import numpy as np
plt.ion()
aia = sunpy.map.Map(AIA_171_IMAGE)
@Cadair
Cadair / pole.scad
Created May 13, 2022 10:17
Pole holder
curve_radius = 0;
inner_radius = (34.8 / 2) + curve_radius;
wall_thickness = 4.4;
offset_amount = 2;
support_radius = 6 + curve_radius;
number_supports = 8;
height = 8 - 2*curve_radius;
module multiple_circles(n, outer_radius, circle_radius) {
delta_i = 360 / n;
@Cadair
Cadair / thermostat.yaml
Last active November 23, 2024 22:32
esphome configuration for my Open Energy Monitor thermostat
# This is an esphome configuration file for the OpenEnergyMonitor Thermostat
# The primary objectives of this configuration file are:
# 1) The temperature used as the sensor for the thermostat should be read from
# homeassistant, this lets you use an average or change the room the
# temperature is based on depending on the time of day etc.
# 2) If homeassisant goes offline the thermostat keeps working.
# To this end there is a sensor "average_temperature" which is recieved from hass
# and a second sensor "combined_temperature" which decides based on if a device
# is connected to the native API or not to use this sensor or the local sensor
# attached to the thermostat.
import numpy as np
import astropy.units as u
from astropy.modeling import Model, CompoundModel
import astropy.modeling.models as m
from astropy.coordinates.matrix_utilities import rotation_matrix
from gwcs.utils import create_projection_transform
from models import *
@Cadair
Cadair / simple_celestial_model.py
Last active December 21, 2021 12:21
A helper class for a common celestial transform
import astropy.units as u
from astropy.modeling import Model
import astropy.modeling.models as m
class SimpleCelestialTransform(Model):
n_inputs = 2
n_outputs = 2
crpix = Parameter()
cdelt = Parameter()
@Cadair
Cadair / wsjt_cloudlog.py
Last active July 9, 2025 04:03
Upload QSOs from WSJT-X to Cloudlog
#!/bin/env python3
"""
WSJT-X to Cloudlog QSO uploader.
This script reads QSO events from the WSJT UDP server and uploads the ADIF records to Cloudlog.
No non-standard library packages are required to run this.
usage: wsjt_cloudlog.py [-h] [--wsjt-port WSJT_PORT] [--wsjt-host WSJT_HOST] [--verbose] url api_key station_id
positional arguments: