parser.add_argument("starname", help="name of star")
    parser.add_argument("--path", help="path to star files", default="./")
    parser.add_argument("--png", help="save figure as a png file", action="store_true")
    parser.add_argument("--eps", help="save figure as an eps file", action="store_true")
    parser.add_argument("--pdf", help="save figure as a pdf file", action="store_true")
    return parser


if __name__ == "__main__":

    # commandline parser
    parser = plot_spec_parser()
    args = parser.parse_args()

    # read in the observed data on the star
    fstarname, file_path = get_full_starfile("m33_j013334.26+303327")
    starobs = StarData(fstarname, path=file_path)
    band_names = starobs.data["BAND"].get_band_names()

    # get the model filenames
    print("reading in the model spectra")
    file_path = "/home/kgordon/Python_git/extstar_data/"
    tlusty_models_fullpath = glob.glob("{}/Models/tlusty_*v10.dat".format(file_path))
    tlusty_models_fullpath = tlusty_models_fullpath[0:10]
    tlusty_models = [
        tfile[tfile.rfind("/") + 1 : len(tfile)] for tfile in tlusty_models_fullpath
    ]

    spectra_names = ["BAND", "STIS"]
    # band_names = ['ACS_F814W', 'V', 'WFC3_F336W', 'WFC3_F160W',
    #               'ACS_F475W', 'WFC3_F110W', 'WFC3_F275W']
示例#2
0
    font = {"size": fontsize}
    mpl.rc("font", **font)
    mpl.rc("lines", linewidth=1)
    mpl.rc("axes", linewidth=2)
    mpl.rc("xtick.major", width=2)
    mpl.rc("xtick.minor", width=2)
    mpl.rc("ytick.major", width=2)
    mpl.rc("ytick.minor", width=2)

    # setup the plot
    fig, ax = plt.subplots(figsize=(13, 10))

    # plot the bands and all spectra for this star
    # plot all the spectra on the same plot
    for k, cstarname in enumerate(starnames):
        fstarname, file_path = get_full_starfile(cstarname)
        starobs = StarData(fstarname, path=file_path)
        starobs.plot(ax, norm_wave_range=[0.2, 0.3] * u.micron, yoffset=2**k)

    # finish configuring the plot
    ax.set_yscale("log")
    ax.set_xscale("log")
    ax.set_xlabel(r"$\lambda$ [$\mu m$]", fontsize=1.3 * fontsize)
    ax.set_ylabel(r"$F(\lambda)$ [$ergs\ cm^{-2}\ s\ \AA$]",
                  fontsize=1.3 * fontsize)
    ax.tick_params("both", length=10, width=2, which="major")
    ax.tick_params("both", length=5, width=1, which="minor")

    # use the whitespace better
    fig.tight_layout()
示例#3
0
    new_samples[:, ndim+2] = (10**samples[:, 10])/new_samples[:, ndim]

    per_params = map(lambda v: (v[1], v[2]-v[1], v[1]-v[0]),
                     zip(*np.percentile(new_samples, [16, 50, 84],
                                        axis=0)))

    return per_params


if __name__ == '__main__':
    # commandline parser
    parser = fit_model_parser()
    args = parser.parse_args()

    # get the full starfilename and path
    fstarname, file_path = get_full_starfile(args.starname)

    # get the observed reddened star data
    reddened_star = StarData(fstarname, path=file_path)
    band_names = reddened_star.data['BAND'].get_band_names()
    spectra_names = reddened_star.data.keys()

    # override for now
    print('possible', spectra_names)
    # spectra_names = ['BAND', 'STIS_Opt']
    # spectra_names = ['BAND', 'STIS_Opt']
    print('only using', spectra_names)

    # override for now
    # band_names = ['U', 'B', 'V']
    # band_names = ['U', 'B', 'V', 'J', 'H', 'K']