diff --git a/species/analysis/fit_planck.py b/species/analysis/fit_planck.py index c1952aae..250513f8 100644 --- a/species/analysis/fit_planck.py +++ b/species/analysis/fit_planck.py @@ -55,7 +55,7 @@ def lnlike(param, distance, spectrum): """ - Internal function for the likelihood probability. + Internal function for the likelihood function. Parameters ---------- @@ -177,7 +177,7 @@ def lnprob(param, class FitPlanck: """ - Class for fitting Planck spectra to spectral and photometric data. + Class for fitting Planck spectra to photometric and/or spectroscopic data. """ def __init__(self, @@ -192,16 +192,16 @@ def __init__(self, object_name : str Object name in the database. filters : tuple(str, ) - Filter names for which the photometry is selected. All available photometry of the - object are used if set to None. + Filter names for which the photometry is selected. All available photometric data of + the object are used if set to None. bounds : dict Parameter boundaries for 'teff' and 'radius'. The values should be provided either as float or as list of floats such that multiple Planck functions can be combined, e.g. ``{'teff': [(1000., 2000.), (500., 1500.)], 'radius': [(0.5, 1.5), (1.5, 2.0)]}``. inc_phot : bool - Include photometry data with the fit. + Include photometric data with the fit. inc_spec : bool - Include spectral data with the fit. + Include spectroscopic data with the fit. Returns ------- @@ -210,7 +210,7 @@ def __init__(self, """ if not inc_phot and not inc_spec: - raise ValueError('No photometric or spectral data has been selected.') + raise ValueError('No photometric or spectroscopic data has been selected.') if 'teff' not in bounds or 'radius' not in bounds: raise ValueError('The \'bounds\' dictionary should contain \'teff\' and \'radius\'.') diff --git a/species/data/companions.py b/species/data/companions.py index 4c520f95..9a110604 100644 --- a/species/data/companions.py +++ b/species/data/companions.py @@ -101,7 +101,10 @@ def get_data(): 'app_mag': {'Paranal/SPHERE.IRDIS_D_H23_2': (17.94, 0.24), # Keppler et al. 2018 'Paranal/SPHERE.IRDIS_D_H23_3': (17.95, 0.17), # Keppler et al. 2018 'Paranal/SPHERE.IRDIS_D_K12_1': (16.65, 0.06), # Müller et al. 2018 - 'Paranal/SPHERE.IRDIS_D_K12_2': (16.44, 0.05)}}, # Müller et al. 2018 + 'Paranal/SPHERE.IRDIS_D_K12_2': (16.44, 0.05), # Müller et al. 2018 + 'Paranal/NACO.Lp': (14.08, 0.33), # Stolker et al. in prep. + 'Paranal/NACO.NB405': (13.91, 0.34), # Stolker et al. in prep. + 'Paranal/NACO.Mp': (13.64, 0.22)}}, # Stolker et al. in prep. 'PDS 70 c': {'distance': (113.43, 0.52), 'app_mag': {'Paranal/NACO.NB405': (15.05, 0.59)}}, # Stolker et al. in prep. diff --git a/species/plot/plot_color.py b/species/plot/plot_color.py index 22c0fd12..78aa08f6 100644 --- a/species/plot/plot_color.py +++ b/species/plot/plot_color.py @@ -92,7 +92,7 @@ def plot_color_magnitude(boxes, """ - print(f'Plotting color-magnitude diagram: {output}... ', end='', flush=True) + print(f'Plotting color-magnitude diagram: {output}...', end='', flush=True) model_color = ('#234398', '#f6a432', 'black') model_linestyle = ('-', '--', ':', '-.') @@ -389,7 +389,7 @@ def plot_color_magnitude(boxes, plt.clf() plt.close() - print('[DONE]') + print(' [DONE]') def plot_color_color(boxes, @@ -454,7 +454,7 @@ def plot_color_color(boxes, None """ - print(f'Plotting color-color diagram: {output}... ', end='', flush=True) + print(f'Plotting color-color diagram: {output}...', end='', flush=True) model_color = ('#234398', '#f6a432') model_linestyle = ('-', '--', ':', '-.') @@ -687,4 +687,4 @@ def plot_color_color(boxes, plt.clf() plt.close() - print('[DONE]') + print(' [DONE]') diff --git a/species/plot/plot_spectrum.py b/species/plot/plot_spectrum.py index 3ebc0c0b..ac16c9b1 100644 --- a/species/plot/plot_spectrum.py +++ b/species/plot/plot_spectrum.py @@ -32,7 +32,7 @@ def plot_spectrum(boxes, scale=('linear', 'linear'), title=None, offset=None, - legend='upper left', + legend=None, figsize=(7., 5.), object_type='planet', quantity='flux', @@ -63,8 +63,9 @@ def plot_spectrum(boxes, Title. offset : tuple(float, float) Offset for the label of the x- and y-axis. - legend : str, None - Location of the legend. + legend : str, tuple, dict, None + Location of the legend (str, tuple) or a dictionary with the ``**kwargs`` of + ``matplotlib.pyplot.legend``, e.g. ``{'loc': 'upper left', 'fontsize: 12.}``. figsize : tuple(float, float) Figure size. object_type : str @@ -465,8 +466,11 @@ def plot_spectrum(boxes, handles, _ = ax1.get_legend_handles_labels() - if handles and legend: - ax1.legend(loc=legend, fontsize=10, frameon=False) + if handles and legend is not None: + if isinstance(legend, (str, tuple)): + ax1.legend(loc=legend, fontsize=8, frameon=False) + else: + ax1.legend(**legend) plt.savefig(os.getcwd()+'/'+output, bbox_inches='tight') plt.clf() diff --git a/species/util/phot_util.py b/species/util/phot_util.py index 3c078f22..35229422 100644 --- a/species/util/phot_util.py +++ b/species/util/phot_util.py @@ -205,8 +205,13 @@ def get_residuals(datatype, if spectrum == 'planck': readmodel = read_planck.ReadPlanck(wavel_range=wavel_range) + model = readmodel.get_spectrum(model_param=parameters, spec_res=1000.) + flux_new = spectres.spectres(new_spec_wavs=wl_new, + old_spec_wavs=model.wavelength, + spec_fluxes=model.flux) + else: if spectrum == 'petitradtrans': # TODO change back diff --git a/species/util/plot_util.py b/species/util/plot_util.py index 9fb31494..036b4b36 100644 --- a/species/util/plot_util.py +++ b/species/util/plot_util.py @@ -137,14 +137,6 @@ def update_labels(param): index = param.index('radius') param[index] = r'$R$ ($\mathregular{R_{Jup}}$)' - if 'scaling' in param: - index = param.index('scaling') - param[index] = 'Scaling' - - if 'offset' in param: - index = param.index('offset') - param[index] = 'Offset' - if 'teff' in param: index = param.index('teff') param[index] = r'$T_\mathregular{eff}$ (K)'