Example #1
0
def test_iad_refitting():
    """
    Check that refitting the IAD gives posteriors that approximately match
    the official Hipparcos values. Only run the MCMC for a few steps because 
    this is a unit test. 
    """

    post, myHipLogProb = nielsen_iad_refitting_test(
        '{}/HIP027321.d'.format(DATADIR),
        burn_steps=10,
        mcmc_steps=200,
        saveplot=None)

    # check that we get reasonable values for the posteriors of the refit IAD
    # (we're only running the MCMC for a few steps, so these are not strict)
    assert np.isclose(0, np.median(post[:, -1]), atol=0.1)
    assert np.isclose(myHipLogProb.plx0, np.median(post[:, 0]), atol=0.1)
Example #2
0
    # The Hipparcos ID of your target. Available on Simbad.
    hip_num = '078092'

    # Name/path for the plot this function will make
    saveplot = 'HD142527_IADrefit.png'

    # Location of the Hipparcos IAD file.
    IAD_file = '{}H{}.d'.format('./', hip_num)

    start = datetime.now()

    # run the fit
    print('Go get a coffee. This will take a few mins! :)')
    nielsen_iad_refitting_test(IAD_file,
                               hip_num=hip_num,
                               saveplot=saveplot,
                               burn_steps=hip_burn_steps,
                               mcmc_steps=hip_mcmc_steps)

    end = datetime.now()
    duration_mins = (end - start).total_seconds() / 60

    print(
        "Done! This fit took {:.1f} mins on my machine.".format(duration_mins))

    ### ACTUAL ORBITIZE ###

    data_table = read_input.read_file(filename)
    print(data_table)

    # system parameters