示例#1
0
def test_annotate_kwargs_and_plot_kwargs():
    wave = 1240 + np.arange(300) * 0.1
    flux = np.random.normal(size=300)

    line_wave = [1242.80, 1260.42, 1264.74, 1265.00, 1265.2, 1265.3, 1265.35]
    line_label1 = ['N V', 'Si II', 'Si II', 'Si II', 'Si II', 'Si II', 'Si II']

    ak = lineid_plot.initial_annotate_kwargs()
    ak['arrowprops']['arrowstyle'] = "->"

    pk = lineid_plot.initial_plot_kwargs()
    pk['color'] = "red"

    lineid_plot.plot_line_ids(
        wave, flux, line_wave, line_label1, annotate_kwargs=ak, plot_kwargs=pk)
def test_annotate_kwargs_and_plot_kwargs():
    wave = 1240 + np.arange(300) * 0.1
    flux = np.random.normal(size=300)

    line_wave = [1242.80, 1260.42, 1264.74, 1265.00, 1265.2, 1265.3, 1265.35]
    line_label1 = ['N V', 'Si II', 'Si II', 'Si II', 'Si II', 'Si II', 'Si II']

    ak = lineid_plot.initial_annotate_kwargs()
    ak['arrowprops']['arrowstyle'] = "->"

    pk = lineid_plot.initial_plot_kwargs()
    pk['color'] = "red"

    lineid_plot.plot_line_ids(wave,
                              flux,
                              line_wave,
                              line_label1,
                              annotate_kwargs=ak,
                              plot_kwargs=pk)
示例#3
0
def pltFT(path, name, xs, xb, units, tvec, argval):
    s = settings.settings()
    fig = plt.figure(figsize=(21, 7))
    ax1 = plt.subplot2grid((2, 1), (1, 0), rowspan=1, colspan=1)
    #     ax1=fig.add_axes([0.1,0.1, 0.8, 0.8])
    l1 = ax1.plot(tvec, xb[1, :], color='r', label="obs")
    l2 = ax1.plot(tvec, xs[1, :], color='g', label="sim")
    handles, labels = ax1.get_legend_handles_labels()
    ax1.legend(handles, labels, loc=1, fontsize='12')
    ax1.set_xlim([5, 27])
    ak = lineid_plot.initial_annotate_kwargs()
    tide = np.array(list(s['tidedict'].keys()))
    cor = np.array(list(s['cordict'].values()))
    tidlab = np.append(tide, cor)
    lineid_plot.plot_line_ids(tvec,
                              xb[1, :],
                              argval,
                              tidlab,
                              ax=ax1,
                              max_iter=30000)
    plt.xlabel('Period [h]', fontsize=12, fontweight='bold')
    plt.ylabel('Phase (deg)', fontsize=12, fontweight='bold')
    ax2 = fig.add_axes([0.125, 0.57, 0.775, 0.34], sharex=ax1)
    l1 = ax2.plot(tvec, xb[0, :], color='r', label="obs")
    l2 = ax2.plot(tvec, xs[0, :], color='g', label="sim")
    handles, labels = ax2.get_legend_handles_labels()
    ax2.legend(handles, labels, loc=1, fontsize='12')
    lineid_plot.plot_line_ids(tvec,
                              xb[0, :],
                              argval,
                              tidlab,
                              ax=ax2,
                              max_iter=30000)  #
    plt.ylabel('Amplitude (' + units + ')', fontsize=12, fontweight='bold')
    plt.setp(ax2.get_xticklabels(), visible=False)
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)
    plt.savefig(path + '/' + name + '.jpg', format='jpg')
    plt.close(fig)
示例#4
0
def test_annotate_kwargs_and_plot_kwargs():
    """User can supply custom annotate and plot kwargs."""
    wave = 1240 + np.arange(300) * 0.1
    flux = RFLUX

    line_wave = [1242.80, 1260.42, 1264.74, 1265.00, 1265.2, 1265.3, 1265.35]
    line_label1 = ['N V', 'Si II', 'Si II', 'Si II', 'Si II', 'Si II', 'Si II']

    ak = lineid_plot.initial_annotate_kwargs()
    ak['arrowprops']['arrowstyle'] = "->"

    pk = lineid_plot.initial_plot_kwargs()
    pk['color'] = "red"

    fig, ax = lineid_plot.plot_line_ids(wave,
                                        flux,
                                        line_wave,
                                        line_label1,
                                        annotate_kwargs=ak,
                                        plot_kwargs=pk)

    return fig
示例#5
0
obj_lines['8'][r'$[SII]6731\AA$']             = 6731.0
obj_lines['8'][r'$[OII]7319\AA$']             = 7319.0
obj_lines['8'][r'$[OII]7330\AA$']             = 7330.0
obj_lines['8'][r'$[ArIII]7136\AA$']           = 7136.0
obj_lines['8'][r'$[ArIII]7751\AA$']           = 7751.0
obj_lines['8'][r'Paschen jump']               = 8207
obj_lines['8'][r'$[SIII]9069\AA$']            = 9069
obj_lines['8'][r'$[SIII]9531\AA$']            = 9531
obj_lines['SHOC579']['Balmer jump']           = 3646.0
obj_lines['SHOC579'][r'$[OII]3726\AA$']       = 3726.0
obj_lines['SHOC579'][r'$[OII]3729\AA$']       = 3728.0
obj_lines['SHOC579'][r'$H\delta$']            = 4101.68
obj_lines['SHOC579'][r'$HeI4026\AA$']         = 4026.68
obj_lines['SHOC579'].update(obj_lines['8'])

ak = lineid_plot.initial_annotate_kwargs()
# ak['arrowprops']['arrowstyle'] = "->"
ak['arrowprops']['relpos'] = (0.5, 0.0)
ak['rotation'] = 90

pk = lineid_plot.initial_plot_kwargs()
pk['linewidth'] = 0.5

factor_norm = 1e-15

rcParams.update(size_dict)
fig = plt.figure()

format_plot = {'8' : {}, 'SHOC579' : {}}
format_plot['8']['xlims']           = {'left': 4300, 'right': 9800}
format_plot['SHOC579']['xlims']     = {'left': 3500, 'right': 9800}
示例#6
0
import time
import lime
from scipy.interpolate import interp1d
from pathlib import Path
from astropy.io import fits
import lineid_plot
from lime.plots import latex_science_float

from src.specsiser.physical_model.extinction_model import ExtinctionModel
from astro.papers.muse_CGCG007.muse_CGCG007_methods import import_muse_fits
from progressbar import progressbar
from matplotlib import pyplot as plt, rcParams, ticker
from matplotlib.cbook import get_sample_data
from matplotlib.offsetbox import OffsetImage, AnnotationBbox

ak_big = lineid_plot.initial_annotate_kwargs()
# ak_big['arrowprops']['relpos'] = (0.5, 0.0)
ak_big['rotation'] = 90

ak_small = lineid_plot.initial_annotate_kwargs()
ak_small['arrowprops'] = dict(width=1e-20,
                              headwidth=1e-20,
                              headlength=1e-20,
                              shrink=1e-20,
                              lw=0.01)
# ak_small['arrowprops']['relpos'] = (0.5, 0.0)
ak_small['rotation'] = 90

pk = lineid_plot.initial_plot_kwargs()
pk['linewidth'] = 0.25