Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#1/5/2022 Michael Ofengenden & Roger Yu & A LOT A LOT of help from Zack Gainsforth | |
import sys, os | |
import hyperspy.api as hs | |
import numpy as np | |
import warnings | |
with warnings.catch_warnings(): | |
warnings.simplefilter("ignore") | |
import tifffile as tif | |
import skimage | |
from skimage.transform import resize |
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 streamlit as st | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import os, sys | |
from scipy.ndimage.filters import gaussian_filter1d | |
from scipy.interpolate import interp1d | |
def ConvolveGaussian(Eraw, Iraw, Sigma): | |
E = np.linspace(Eraw[0], Eraw[-1], 10000) | |
dE = E[1] - E[0] |
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 | |
from scipy.signal import medfilt, convolve | |
from scipy.signal.windows import gaussian | |
import os, sys | |
SpectraPath = os.path.join(".") | |
SpectraFiles = { | |
"Top Crystal" : os.path.join(SpectraPath, "Top Crystal.txt"), |
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 | |
from skimage.io import imread, imsave | |
from icecream import ic | |
# from QuickPlot import PrettyPlot | |
E = np.genfromtxt('532_210619074_energies.txt') | |
x = imread('532_210619074_CPX_Linescan.tif') | |
# The pixels are 100 nm in length, and the image was rotated 65 degrees. Therefore, the length of a pixel in this raster is (about 110 nm): |
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 | |
from scipy.signal import medfilt, convolve | |
from scipy.signal.windows import gaussian | |
import os, sys | |
STXMPath = os.path.join("..", "210628", "NS_210628066 Fe-L", "Spectra") | |
PtychoPath = os.path.join("..", "210629", "NS_210629000 - Fe-L ptycho", "Spectra Abs") | |
SpectraFiles = {"3+ inclusion (ptycho)": os.path.join(PtychoPath, "3+ inclusion.txt"), |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.constants import c, h, e | |
from astropy.io import fits | |
import numpy as np | |
from sys import argv | |
def LoadSpectrum(SpectrumName='0090340201.fluxed'): | |
spectrumfits = fits.open(SpectrumName) | |
spec = spectrumfits[1] | |
angstrom = np.nan_to_num(spec.data.field('CHANNEL').copy()) |
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
# Filenames are: RxxxxxxxxxxRyS00zAAAAAA1001.FTZ | |
# xxxxxxxxxx is the observation ID. | |
# Ry = R1 or R2 depending on whether it is RGS instrument 1 or 2. | |
# S00z can be s004 or 5 depending on which RGS. | |
# AAAAAA is SRSPEC for the spectrum, RSPMAT for the response matrix, BGSPEC for the background spectrum. | |
# Also need fluxedto2col.py to do the conversion of the fluxed file into a two column output. | |
# For each ObsID, combine the RGS 1 and RGS 2 first order spectrum, produce a fluxed output, and convert that into a 2 column file. | |
for OBSID in 0693490201 0090340201 |