What we do here

Here we test the base MatchConfFile object. It teachs you how to create a new conf file and run match from scratch. It also create and add ties and finally show how to optimize a parameter.


In [ ]:
import Match
import os
from matplotlib import pyplot as plt
%matplotlib inline

Create from Scratch


In [ ]:
_ = reload(Match)

mcf = Match.MatchConfFile("teste.conf")

Set Series


In [ ]:
_ = mcf.setSeries(1, "LR04core")
_ = mcf.setSeries(2, "LR04core")

Test set parameters


In [ ]:
mcf.generateSpeeds(1, 5)

In [ ]:
mcf.nomatch = 1.0
mcf.speedpenalty = 1.0
mcf.targetspeed = "1:1"
mcf.speedchange = 1.0
mcf.tiepenalty = 1.0
mcf.gappenalty = 1.0

In [ ]:
mcf.report()

Test guess parameters


In [ ]:
mcf.guessParameters().report()

Add a tie point


In [ ]:
tfile = Match.Tie("new_tie")
tfile.set_tie(1500, 1400, label="A")
tfile.set_tie(1700, 1600, label="B")
tfile.save()

mcf.tiefile = "new_tie"

In [ ]:
sa = mcf.getSeries(1)
sa.plot()

In [ ]:
sb = mcf.getSeries(2)
sb.plot()

Save the file


In [ ]:
mcf.save()

In [ ]:
mcf.saveas("teste2.conf")

Read the written conf file


In [ ]:
mcf = Match.MatchConfFile("teste.conf")
mcf.report()

Run


In [ ]:
mcf.optimize("speedchange", [0.0, 5.0, 10.])

In [ ]:
mcf.run()

In [ ]:
plt.figure(figsize=(20,10))
mcf.getSeries(1).plotcomp(mcf.getSeries(2))

In [ ]:
mcf.clean()

Clean Up


In [ ]:
os.unlink("teste.conf")
os.unlink("teste2.conf")
os.unlink("new_tie")