This file contains hidden or 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 dalek import assemble_tardis_model | |
from dalek.base.model import SimpleTARDISUncertaintyModel, NormRedSpectrum, LogLikelihood | |
from dalek.base.base import BaseLikelihoodModel | |
from dalek.base.transform import uniform_transform | |
from astropy import units as u, constants as const | |
import os | |
base_dir = '/home/hpc/pr94se/di73qom/projects/tardis/dalek/test_artis_run/artis_fit' | |
artis_filename = os.path.join(base_dir, 'aaflux_057.dat') |
This file contains hidden or 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 import coordinates as coord | |
from astropy import units as u, constants as const | |
import pandas as pd | |
cats = ['ut150625_g.h5', 'ut150625_r.h5', 'ut150625_u.h5'] | |
gdata = pd.read_hdf(cats[0], 'data') | |
gdata = gdata[gdata.type == 1] | |
gcat = coord.SkyCoord(gdata.RA.values, gdata.Dec.values, unit=u.degree) | |
rdata = pd.read_hdf(cats[1], 'data') |
This file contains hidden or 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 argparse | |
from astropy.io import fits | |
from astropy import wcs | |
import os | |
from glob import glob | |
import pandas as pd | |
parser = argparse.ArgumentParser(description='Convert DECAM photometry to Tables') |
This file contains hidden or 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.table import Table | |
from astropy.io import fits | |
import pandas as pd | |
import numpy as np | |
class XShooterEchelle(object): | |
coef_types = ['cen', 'edgup', 'edglo'] |
This file contains hidden or 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 | |
from scipy import optimize | |
import numpy as np | |
from extract_spectral.trace import GaussianPolynomialTrace, ModelFrame2D, LogLikelihood, LinearLstSqExtraction | |
from DIRECT import solve | |
from astropy.modeling import models | |
#download from | |
data = fits.getdata('IRCQ00467448.fits') | |
#data = fits.getdata('test_data/fors_many_stars.fits').T |
This file contains hidden or 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
class IRCSEchelle(Model): | |
inputs = () | |
outputs = ('polygon_array', ) | |
slit_width = Parameter(default=5.) | |
slit_length = Parameter(default=10.) | |
def evaluate(self, slit_width, slit_length, ...): | |
parray = run_idl_code(slit_width, slit_length) | |
return parray |
This file contains hidden or 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 | |
from bs4 import BeautifulSoup | |
base_url = 'http://henke.lbl.gov/cgi-bin/pert_cgi.pl' | |
def get_photo_absorption_cross_section(element_code, energy): | |
data = requests.get(base_url, data=dict( | |
Element=element_code, Energy=energy)) | |
bs = BeautifulSoup(data.text) |
This file contains hidden or 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
class MultiSpecWCS(Model): | |
def __init__(self, single_wcs=[list of 1d WCSs]): | |
self.single_wcs = single_wcs | |
def __call__(self, x, y): | |
assert type(x) == int # we need to make sure that the user does not expect to interpolate between two adjacent spectra |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
import os | |
import shutil | |
pdflatex_bin = 'pdflatex' | |
bibtex_bin = 'bibtex' |
This file contains hidden or 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
ERROR: AttributeError: 'Spectrum1DLookupWCS' object has no attribute '_param_dim' [astropy.modeling.core] | |
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
<ipython-input-3-01a2fdaa6cd5> in <module>() | |
----> 1 specwcs.Spectrum1DLookupWCS(np.arange(3000, 6000) * u.Angstrom) | |
/Users/wkerzend/scripts/python/specutils/specutils/wcs/specwcs.py in __init__(self, lookup_table, unit, lookup_table_interpolation_kind) | |
60 self.lookup_table_parameter = lookup_table * unit | |
61 elif unit is None: # lookup_table is already unit'd | |
---> 62 self.lookup_table_parameter = lookup_table |