This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
def area_contour_image(img: np.ndarray, quantiles: list[float], ax=None, x=None, y=None, **contour_kwds): | |
normalized_img = (img - np.min(img)) / (np.max(img) - np.min(img)) | |
flattened_img = normalized_img.flatten() | |
# sort pixels: small areas first, then large areas | |
sorted_values = np.sort(flattened_img)[::-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from astropy.io import fits | |
import astropy.table as atab | |
import astropy.time as atime | |
import astropy.units as u | |
import numpy as np | |
from stixdcpy import instrument as inst | |
def load_stix_pixel_data_to_spectrogram(fn: str) -> dict: | |
pdat = load_stix_pixel_data(fn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import astropy.units as u | |
import numpy as np | |
from sklearn import linear_model | |
import typing | |
@u.quantity_input | |
def decompose( | |
counts: u.ct, | |
energy_bins: u.keV, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import parse | |
import os | |
import sys | |
verbose = True | |
def vp(*args, **kw): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import numpy.typing | |
''' | |
Perform a flux- (i.e. area-) conserving rebinning of a histogram, | |
given its edges and a set of new edges. | |
The __name__ ... section has an example using a power law. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import functools | |
import multiprocessing as mp | |
import os | |
import pathlib | |
import sys | |
import imageio | |
import numpy as np | |
import sunpy.map |