Module Contents
This documentation is automatically generated by scanning all the source code. Parts may be incomplete.
pymad8.Input module
- pymad8.Input.decodeFileLine(input)
- Decode line for each element typeinput : string of a mad8 line
- pymad8.Input.removeComments(input)
- Remove comment linesinput : list of file lines
- pymad8.Input.removeContinuationSymbols(input)
- Remove continuation symbols from inputinput : list of file lines
- pymad8.Input.tidy(input)
- Tidy input, remove EOL, remove empty linesinput : list of file lines
pymad8.Output module
- class pymad8.Output.Output(filename, filetype='twiss')
Bases:
objectClass to load different Mad8 output files in a Pandas DataFrame>>> twiss = pymad8.Output(‘/twiss.tape’)>>> rmat = pymad8.Output(‘/rmat.tape’,’rmat’)>>> chrom = pymad8.Output(‘/chrom.tape’,’chrom’)>>> envel = pymad8.Output(‘/envel.tape’,’envel’)>>> survey = pymad8.Output(‘/survey.tape’,’survey’)>>> struct = pymad8.Output(‘/struct.tape’,’struct’)>>> track = pymad8.Output(‘/track.tape’,’track’)>>> optics = pymad8.Output(‘/optics.tape’,’optics’)By default the filetype is twiss- Clear()
Empties all data structures in this instance
- calcBeamSize(EmitX, EmitY, Esprd, BunchLen=0)
Calculate the beam sizes and beam divergences in both planes for all elements Then the four columns are added at the end of the DataFrame Works only if a twiss file was loaded previously
- getAperture(index, defaultAperSize=0.1)
- Get aperture of an element using corresponding indexIf none provided or is 0 : set to a default aperture of 0.1m
- getColumnsByKeys(keylist)
Return Columns that ar in keylist
- getElementByIndex(indexlist, keylist)
Return value of elements given their indices and for chosen columns
- getElementByNames(namelist, keylist)
Return value of elements given their names and for chosen columns
- getElementByNearestS(s, keylist)
Return value of elements at a given s position and for chosen columns
- getIndexByNames(namelist)
Return Index or Index list of elements that are in namelist
- getIndexByNearestS(s)
Return Index of the closest element in the beamline
- getIndexByTypes(typelist)
Return Index or Index list of elements that are in typelist
- getIndexByValues(**args)
- Return Index or Index list of elements that have certain values for a chosen columnSame arguments as getRowsByValues
- getNameByNearestS(s)
Return Name of the closest element in the beamline
- getNamesByIndex(indexlist)
Return Name or Name list of elements that are in indexlist
- getNamesByTypes(typelist)
Return Name or Name list of elements that are in typelist
- getNamesByValues(**args)
- Return Name or Name list of elements that have certain values for a chosen columnSame arguments as getRowsByValues
- getRowByNearestS(s)
Return Rows of the closest element in the beamline
- getRowsByFunction(f)
Return a sub-datafarme using a boolean function
- getRowsByIndex(indexlist)
Return Rows of elements that are in indexlist
- getRowsByNames(namelist)
Return Rows of elements that are in namelist
- getRowsByTypes(typelist)
Return Rows of elements that are in typelist
- getRowsByValues(key=None, minValue=-inf, maxValue=inf, equalValues=None)
Return Rows of elements that have certain values for a chosen column
- getTypeByNearestS(s)
Return Type of the closest element in the beamline
- getTypesByIndex(indexlist)
Return Type or Type list of elements that are in indexlist
- getTypesByNames(namelist)
Return Type or Type list of elements that are in namelist
- getTypesByValues(**args)
- Return Type or Type list of elements that have certain values for a chosen columnSame arguments as getRowsByValues
- plotXY(Xkey, Ykey, color=None, label=None)
Quick plot of one colums of our dataframe w.r.t. another
- sMax()
Return maximal S value
- sMin()
Return minimal S value
- subline(start, end)
Select only a portion of the inital lattice
pymad8.Plot module
- pymad8.Plot.AddMachineLatticeToFigure(figure, mad8opt, tightLayout=True)
- Add a diagram above the current graph in the figure that represents the accelerator based on a mad8 twiss file.Note you can use matplotlib’s gcf() ‘get current figure’ as an argument.>>> pymad8.Plot.AddMachineLatticeToFigure(gcf(), ‘/mad8_twiss_tape’)
- class pymad8.Plot.Optics(mad8file, beamParams=None)
Bases:
objectClass to load pymad8 DataFrames and make optics plots>>> plot_data = pymad8.Plot.Optics(‘/mad8_twiss_tape’)>>> plot_data.Betas()Plot avaliable are plotBetas, plotAlphas, plotMus, plotDisp and plotSigmas- Alpha()
Plot the Alpha functions for both planes and both Mad
- Beta()
Plot the Beta functions for both planes and both Mad
- Disp()
Plot the Dispertion functions for both planes and both Mad
- Mu()
Plot the Mu functions for both planes and both Mad
- Sigma()
Plot the beam size and beam divergence functions for both planes and both Mad