Skip to content

Instantly share code, notes, and snippets.

View streeto's full-sized avatar

André Luiz de Amorim streeto

  • UFSC
  • Florianópolis
View GitHub Profile
@streeto
streeto / base.py
Last active August 29, 2015 14:03
base.py rolled back to old StarlightBase behavior.
'''
Created on 30/05/2014
@author: andre
'''
import pystarlight.io # @UnusedImport
import atpy
import numpy as np
from scipy.interpolate.interpolate import interp1d
@streeto
streeto / velocity_fix.py
Created June 30, 2014 20:58
Correct behaviour in velocity_fix using 1-d fluxes
'''
Created on Jun 27, 2013
@author: andre
'''
import numpy as np
__all__ = ['SpectraVelocityFixer']
@streeto
streeto / gist:88a706ea71d2f4102816
Last active August 29, 2015 14:02
How to use velocity_fixer with PyCASSO
def calc_rest_frame_spectra(K, target_vd):
if target_vd is None:
target_vd = np.percentile(K.v_d, 95.0)
from pystarlight.util.velocity_fix import SpectraVelocityFixer
fixer = SpectraVelocityFixer(K.l_obs, K.v_0, K.v_d, nproc=None)
logger.debug('Computing rest frame spectra from scratch...')
f_syn_rest__lz = fixer.fix(K.f_syn, target_vd)
f_obs_rest__lz, f_err_rest__lz, flags = fixer.fixFlagged(K.f_obs, K.f_err, K.f_flag > 0.0, target_vd)
f_flag_rest__lz = np.where(flags | (f_obs_rest__lz < 0.0), 1.0, 0.0)
@streeto
streeto / gist:05b952b90fa47cbc8fe5
Created May 19, 2014 18:53
Resampling mass histograms
'''
Created on 19/05/2014
@author: andre
'''
import numpy as np
import matplotlib.pyplot as plt
###################################################################################################