Skip to content

Instantly share code, notes, and snippets.

@streeto
Last active August 29, 2015 14:02
Show Gist options
  • Save streeto/88a706ea71d2f4102816 to your computer and use it in GitHub Desktop.
Save streeto/88a706ea71d2f4102816 to your computer and use it in GitHub Desktop.
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)
return f_obs_rest__lz, f_syn_rest__lz, f_err_rest__lz, f_flag_rest__lz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment