def createPlot(experiment, domainSizeKm, prefix, fig, subplotNum, notFullStokesModelType):
    domainSizeKm=int(domainSizeKm)
    axis = fig.add_subplot(2,3,subplotNum)
    axis.set_title(str(domainSizeKm) + " km", size="medium")
    #Read the data that came from the Glimmer run
    glimFileName = prefix + experiment + "%03d"%domainSizeKm + ".txt"
    glimFlowline = intercomparison.grabFlowline(glimFileName)

    axis.plot(glimFlowline.getPointLocations(), glimFlowline.getDependantVariable(0), color=(0,0,0))

    for isFullStokes in [True, False]:
        if isFullStokes:
            modelType = "full-stokes"
        else:
            modelType = notFullStokesModelType
        models = intercomparison.getDataFiles("ismip_all", experiment, domainSizeKm, modelType)
        
        flowlines = []
        for f in models:
            try:
                fl = intercomparison.grabFlowline(f)
                fl.fixRange()
                flowlines.append(fl)
            except Exception, e:
                print f, "failed to load:", e
                raise

        #Compute the mean and standard deviations of the experiments
        mean, stdev = intercomparison.aggregateExperimentFlowlines(flowlines, glimFlowline.getPointLocations())
        
        if not isFullStokes:
            myErr,oneStdev,pos = maxObservedError(mean, stdev, glimFlowline)
            print '\t'.join([str(domainSizeKm) + " km", str(myErr), str(oneStdev), str(pos)])

        #Plot the mean and std. dev.
        if isFullStokes:
            plotAggregatedFlowlines(axis, mean, stdev, 0, (1,0,0), "Full Stokes")
        else:
            plotAggregatedFlowlines(axis, mean, stdev, 0, (0,0,1), "First Order")

        #Modify the axes tick lables to have smaller fonts
        for tick in axis.xaxis.get_major_ticks():
            tick.label1.set_fontsize("xx-small")
        for tick in axis.yaxis.get_major_ticks():
            tick.label1.set_fontsize("xx-small")
def performRegressionTest(inputFile):
    experiment = inputFile[4]
    domainSizeKm = int(inputFile[5:8])

    #Read the data file from the Glimmer run
    glimFlowline = intercomparison.grabFlowline(inputFile)
   
    #Read the data files from the intercomparison experiment
    models = intercomparison.getDataFiles("ismip_all", experiment, domainSizeKm, "partial-stokes")
    flowlines = []
    for f in models:
        try:
            fl = intercomparison.grabFlowline(f)
            fl.fixRange()
            flowlines.append(fl)
        except Exception, e:
            print f, "failed to load:", e

        #Compute the mean and standard deviations of the experiments
        meanFlowline, stdevFlowline = intercomparison.aggregateExperimentFlowlines(flowlines, glimFlowline.getPointLocations())