def get_slit(galaxy, h, w, pa): from checkcomp import checkcomp cc = checkcomp() pa = np.radians(pa) data_file = "%s/Data/vimos/analysis/galaxies.txt" % (cc.base_dir) # different data types need to be read separetly z_gals, vel_gals, sig_gals, x_gals, y_gals = np.loadtxt(data_file, unpack=True, skiprows=1, usecols=(1,2,3,4,5)) galaxy_gals = np.loadtxt(data_file, skiprows=1, usecols=(0,),dtype=str) i_gal = np.where(galaxy_gals==galaxy)[0][0] res=0.67 x_cent, y_cent = x_gals[i_gal]*res, y_gals[i_gal]*res return get_slit2(h, w, np.degrees(pa), x_cent, y_cent)
# Routine to show global Mg-sigma relation import numpy as np # for array handling from astropy.io import fits # reads fits files (is from astropy) from checkcomp import checkcomp cc = checkcomp() if cc.device == -1: cc = checkcomp(override='glamdring') if cc.remote: import matplotlib # 20160202 JP to stop lack-of X-windows error matplotlib.use('Agg') # 20160202 JP to stop lack-of X-windows error import matplotlib.pyplot as plt # used for plotting else: import matplotlib.pyplot as plt # used for plotting from errors2_muse import run_ppxf, set_params, get_dataCubeDirectory from errors2 import apply_range from classify import get_R_e from pop import get_absorption from global_mg_sigma import in_aperture # aperture in arcsec def mg_sigma(galaxy, aperture=1.0): ## ----------===============================================--------- ## ----------============= Input parameters ===============--------- ## ----------===============================================--------- params = set_params(reps=10, produce_plot=False, opt='pop', res=8.4, use_residuals=True)
# each bin. # max: use the maximum of the residuals in # each bin. # False: do not calculate and produce plot of # residuals. # overplot {} Dictionary containing name of thing to overplot and its color. # D None Option to pass in the Data object instead of loading it. ## ************************************************************** ## import numpy as np # for array handling import glob # for searching for files from astropy.io import fits # reads fits files (is from astropy) from astropy import units as u from astropy.coordinates import SkyCoord from matplotlib.collections import LineCollection from checkcomp import checkcomp cc = checkcomp() if 'home' not in cc.device: import matplotlib # 20160202 JP to stop lack-of X-windows error matplotlib.use('Agg') # 20160202 JP to stop lack-of X-windows error import matplotlib.pyplot as plt # used for plotting from plot_velfield_nointerp import plot_velfield_nointerp from plot_histogram import plot_histogram import os from sauron_colormap2 import sauron2 as sauron import cPickle as pickle from errors2_muse import get_dataCubeDirectory # Give axes a saveTo property plt.axes.saveTo = property(lambda self: str()) # Give axes an x and y on figure grid property plt.axes.figx = property(lambda self: int())
# Routine to create a 'bin' which contains the entire image. import numpy as np import os from astropy.io import fits from checkcomp import checkcomp cc = checkcomp() from Bin import trapz_uncert from global_mg_sigma import in_aperture from tools import moving_weighted_average, gaussian from classify import get_R_e n_e = 100 # cm^-3 c = 299792.458 # speed of light in km/s H0 = 70 # km/s/Mpc # Solar masses def get_Mass(Ha_flux, D, instrument='vimos'): if instrument == 'vimos': return 280 * (D/10)**2 * (Ha_flux*10**-15/10**-14) * (1000/n_e) elif instrument == 'muse': return 280 * (D/10)**2 * (Ha_flux*10**-20/10**-14) * (1000/n_e) def whole_image(galaxy, verbose=True, instrument='vimos'): print galaxy data_file = "%s/Data/vimos/analysis/galaxies.txt" % (cc.base_dir) galaxy_gals = np.loadtxt(data_file, unpack=True, skiprows=1, usecols=(0,), dtype=str) i_gal = np.where(galaxy_gals==galaxy)[0][0] if instrument=='vimos': from errors2 import run_ppxf, apply_range, set_params, get_dataCubeDirectory
## Propergate uncertainty ## ================================================================== ## warrenj 20150216 Process to progerate the uncertainty using Monty ## Carlo methods to get uncertainty in velocity space. ## warrenj 20170405 Addapted to get sigma_e import numpy as np # for array handling import glob # for searching for files from astropy.io import fits # reads fits files (is from astropy) from scipy import ndimage # for gaussian blur from scipy.spatial.distance import cdist import os import sys from checkcomp import checkcomp cc = checkcomp() if cc.device == -1: cc = checkcomp(override='glamdring') if cc.remote: import matplotlib # 20160202 JP to stop lack-of X-windows error matplotlib.use('Agg') # 20160202 JP to stop lack-of X-windows error import matplotlib.pyplot as plt # used for plotting else: import matplotlib.pyplot as plt # used for plotting # import of matplotlib.pyplot is within errors routine from errors2 import run_ppxf, set_params, apply_range from ppxf import ppxf import ppxf_util as util from classify import get_R_e