Skip to content

Instantly share code, notes, and snippets.

View wkerzendorf's full-sized avatar

Wolfgang Kerzendorf wkerzendorf

View GitHub Profile
class QSeries(pd.Series):
_metadata = ["unit", "descriptor"]
@property
def _constructor(self):
return QSeries
@property
def _constructor_expanddim(self):
return QDataFrame
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#### implementation 1 ####
class GenericModel(object):
def __init__(self, *args):
for property in args:
self.cells_property = {some dictionary containing each cell property}
# example
self.cells_property = {'velocity':Velocity(asdasd)}
self.__dict__[property.name] = property
@wkerzendorf
wkerzendorf / gist:71cae173fdb866e911995e881e216fa4
Created February 12, 2020 16:15
run-dalek-jobarray.sbatch
#!/bin/bash
#SBATCH --job-name=dalek-jobarray
#SBATCH --nodes=1
#SBATCH --cpus-per-task=20
#SBATCH --mem=40GB
#SBATCH --time=02:00:00
#SBATCH --array=0-300
### ACTIVATING CONDA ####
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wkerzendorf
wkerzendorf / read_cmfgen_file.py
Created July 18, 2017 12:47
read cmfgen spectrum
from collections import OrderedDict
from astropy import units as u
import numpy as np
import pandas as pd
def read_cmfgen(fname):
nu = []
flux = []
current_data = nu
@wkerzendorf
wkerzendorf / read_cmfgen_file.py
Created July 18, 2017 12:47
read cmfgen spectrum
from collections import OrderedDict
from astropy import units as u
import numpy as np
import pandas as pd
def read_cmfgen(fname):
nu = []
flux = []
current_data = nu
import luigi
from glob import glob
import os
raw_zips = '/1002/*.gz'
class ExtractGZ(luigi.Task):
document_id = luigi.Parameter()
def output(self):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from astropy import wcs
from scipy import optimize
# this doesn't include the precise function names - just look them up on the astropy wcs website
def fit_func(crval1, crval2, x, y, ra, dec):
w = wcs.WCS(naxis=2)
w.wcs.crval = [crval1, crval2]
ra_wcs, dec_wcs = w.pix_to_world(x, y)
return (ra_wcs - ra)**2 + (dec_wcs - dec)**2