Skip to content

Instantly share code, notes, and snippets.

@wtbarnes
wtbarnes / aia-prep-pipeline.py
Created June 10, 2021 13:30
Pipeline for creating aligned, level 1.5 cutouts from level 1 AIA images
"""
Process images from level 1 FITS to level 1.5 aligned cutouts in Zarr
"""
import copy
import glob
import os
import aiapy.calibrate as ac
import astropy.units as u
from astropy.coordinates import SkyCoord
@wtbarnes
wtbarnes / straighten-loop.py
Created May 27, 2021 18:13
"Straighten" a coronal loop by finding pixel indices that correspond to some loop with a fixed width
"""
Functions for selecting pixels from loops
"""
from astropy.coordinates import SkyCoord
import astropy.units as u
import numpy as np
from scipy.interpolate import splev, splprep
__all__ = [
'straight_loop_indices',
@wtbarnes
wtbarnes / start-hydrad-screen.sh
Last active February 4, 2021 16:56
Start HYDRAD runs in detached screen sesssions
# This function starts a HYDRAD simulation in a detached screen session
# and names the screen based on the path to the directory containing the
# simulation. It takes one argument, the path to the simulation directory.
hydrad_screen () {
screen -dm -S "$(echo $1 | tr / _)" bash -c "cd $1; ./HYDRAD.exe > job.status"
}
# Given a directory containing multiple HYDRAD directories, this function
# starts a HYDRAD simulation for each in their own detached screen session
@wtbarnes
wtbarnes / negative-intensities.ipynb
Created December 17, 2020 23:41
Notebook showing the effect of negative intensity values in AIA images on the PSF and prep steps
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wtbarnes
wtbarnes / fiasco-demo.ipynb
Created November 13, 2020 18:43
Demo notebook of some of the capabilities of the fiasco package
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wtbarnes
wtbarnes / sunkit-models-ideas.md
Last active June 16, 2021 15:05
A description of a SunPy-affiliated package for commonly-used solar models

sunkit-models

This is a proposed SunPy-affiliated package for storing commonly-used models in solar physics. The definition of what exactly constitutes a model is a bit vague, but in my mind, I'm thinking of something that can be easily captured by an analytical function or a small bit of data (i.e. <1 MB).

Proposed Models

  • Models of the interior temperature, density (some of these are already in sunpy.sun.models)
  • "Canonical" loop models (some of these are already coded up here)
@wtbarnes
wtbarnes / settings.json
Created August 31, 2020 19:22
My VSCode configuration file
{
"window.openFilesInNewWindow": "on",
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "Noctis Minimus",
"window.zoomLevel": 0,
"files.associations":{
"SConstruct":"python",
"SConscript":"python",
"*.asdf":"yaml",
"*.slurm":"shellscript",
@wtbarnes
wtbarnes / jlab-environment.yml
Last active August 29, 2022 21:50
conda environment file and scripts for setting up a Jupyterlab environment
name: jupyterlab
channels:
- conda-forge
dependencies:
- python
- pip
- nodejs
- nb_conda
- pip:
- ipykernel
@wtbarnes
wtbarnes / whats-new-in-sunpy.ipynb
Created May 15, 2020 14:37
A demo of some of the new features in SunPy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wtbarnes
wtbarnes / colorbar-positions-example.py
Created April 30, 2020 15:35
A quick example showing how to position vertical and horizontal colorbars using the axis positions
"""
A very basic example of how to position colorbars nicely
"""
import numpy as np
import matplotlib.pyplot as plt
# Vertical
fig = plt.figure()
ax1 = fig.add_subplot(121)
im1 = ax1.imshow(np.random.rand(10,10))