#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'ExodusIIReader'
reader = ExodusIIReader(FileName=['C:\\Users\\John\\Desktop\\download\\V_171_V_d_2_um_phi_4.50_eV_tOn_0.5_ns.e'])
reader.GenerateObjectIdCellArray = 1
reader.GenerateGlobalElementIdArray = 1
reader.ElementVariables = reader.ElementVariables.Available
reader.PointVariables = reader.PointVariables.Available
reader.ElementBlocks = reader.ElementBlocks.Available
reader.ApplyDisplacements = 1
reader.DisplacementMagnitude = 1.0

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()

# create a new 'Integrate Variables'
integrateVariables1 = IntegrateVariables(Input=reader)

# create a new 'Plot Selection Over Time'
selection = SelectCells(query="id==0", proxy=integrateVariables1)
plotSelectionOverTime1 = PlotSelectionOverTime(Input=integrateVariables1, Selection=selection)
plotSelectionOverTime1.OnlyReportSelectionStatistics = 0

# create a new 'Probe Location'
probeLocation1 = ProbeLocation(Input=reader, ProbeType='Fixed Radius Point Source')
probeLocation1.PassFieldArrays = 1
probeLocation1.ComputeTolerance = 1
probeLocation1.Tolerance = 2.220446049250313e-16
probeLocation1.ProbeType.Center = [0.0, 0.0, 0.0]
probeLocation1.ProbeType.NumberOfPoints = 1
probeLocation1.ProbeType.Radius = 0.0

# create a new 'Plot Selection Over Time'
selection = SelectPoints(query="id==0",proxy=probeLocation1)
plotSelectionOverTime2 = PlotSelectionOverTime(Input=probeLocation1, Selection=selection)
plotSelectionOverTime2.OnlyReportSelectionStatistics = 0

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()

SaveData('C:/Users/John/Desktop/data/integrated.csv', proxy=plotSelectionOverTime1, Precision=6, UseScientificNotation=1, WriteAllTimeSteps=1)
SaveData('C:/Users/John/Desktop/data/cathode.csv', proxy=plotSelectionOverTime2, Precision=6, UseScientificNotation=1, WriteAllTimeSteps=1)