Exemplo n.º 1
0
# End performJob-function


if __name__ == '__main__':
    #main()
    
    #%%
    # Load lags from file
    fileName = '/Users/uqnsomme/Documents/Obelix/Asymm/Chains/MyChainSkewGauss0.dat'    
    data = np.loadtxt(fileName)
    lags = data[:, 2]
    
    # Create histogram of lags
    plt.figure(figsize=(6,10), dpi=500)
    n, bins, patches = plt.hist(lags, bins=100)
    plt.xlabel('Time lag', fontsize='large')
    plt.ylabel('Number of instances', fontsize='large')
    
    maxheight = 1000 * np.ceil(np.max(n)*0.001)
    ax = plt.axes()
    ax.xaxis.set_major_locator(MultipleLocator(200))
    ax.xaxis.set_minor_locator(MultipleLocator(100))
    ax.yaxis.set_major_locator(MultipleLocator(1000))
    ax.yaxis.set_minor_locator(MultipleLocator(500))
    ax.set_aspect(np.max(bins)/maxheight)
    
    #%%
    conv = Convergence()
    conv.plotGelmanRubin(fileName, 10, 50)
    
Exemplo n.º 2
0
 
 # Initialisation
 AGN = createOzDESAGN(QSOtemplate)
 stack = Stacking()
 stats = Stats()
 conv  = Convergence()
 
 plotOzDESAGN(QSOtemplate, plotIndividuals=False, binends=binends, name='MgII')
 
 # Create AGN
 AGN.generateAGN(limits, True, number, resDir, fName)
 output = AGN.generateLightCurveParameters(section, resDir+fName)
 AGN.printLightCurveParametersToFile(output, resDir+params)
 lag = printLagValueInParameterBin(resDir+params, limits, emLine=emLine)
 
 # Do the Javelin magic
 runJavelinOnFakeData(resDir+params, limits, number, resDir, string, emLine=emLine)
 
 # Stack and analyse 
 LLH, lags, lagMaxes = stack.stackData(resDir, string, number, resDir+params, limits, meanTrueLag=lag, binsize=10, 
                                       polydeg=20, plotLags=False, plotLLHs=False, plotStacked=True, indivStat=False)
 LLHmax, LLHmin, LLHplus = stats.getLikelihoodEstimates(lags, LLH, printResults=True)
 med1, med1min, med1max  = stats.getMedianEstimates(LLH, lags, printResults=True)
 ##med2, med2min, med2max  = stats.getMedianEstimates(lagMaxes, printResults=True)
 
 # Analysis of results
 plotAChain(chainDir+'MyChain'+string+'0.dat')
 R = conv.GelmanRubin(chainDir+'MyChain'+string+'0.dat', 10, 10, False)
 print 'Gelman-Rubin R =', R
 conv.plotGelmanRubin(chainDir+'MyChain'+string+'0.dat', 10, 10)