Пример #1
0
magnification = 2
viewSize = [700, 600]
backgroundColor = [1, 1, 1]  # set background color to white

# Read the desired outputs/metrics from the csv file:
fp_jsonIn = data_IO.open_file(kpiFileAddress)
kpihash = json.load(fp_jsonIn)
kpihash = pvutils.byteify(kpihash)
fp_jsonIn.close()
print(kpihash)

# disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# Read data file
data2Read = pvutils.getfieldsfromkpihash(kpihash)
dataReader = pvutils.readDataFile(dataFileAddress, data2Read)

# Initialize renderView and display
renderView1, readerDisplay = pvutils.initRenderView(dataReader, viewSize,
                                                    backgroundColor)

print("Generating KPIs")

# Set component to "Magnitude" if not given for vector/tensor fields
for kpi in kpihash:
    kpihash[kpi] = pvutils.correctfieldcomponent(dataReader, kpihash[kpi])

fp_csv_metrics = data_IO.open_file(metricFile, "w")
fp_csv_metrics.write(",".join(['metric', 'ave', 'min', 'max', 'sd']) + "\n")
Пример #2
0
# kpiFileAddress = 'boxKPI.csv'
# metricFileName = "metrics.csv"

solveexoFileAddress = sys.argv[1]
kpiFileAddress = sys.argv[2]
outputDir = sys.argv[3]
metricFileName = sys.argv[4]
individualImages = True
magnification = 2

# Read the desired outputs/metrics from the csv file:
fp_csvin = data_IO.open_file(kpiFileAddress)
kpihash = pvutils.read_csv(fp_csvin)
fp_csvin.close()

cellsarrays = pvutils.getfieldsfromkpihash(kpihash)

#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

## Read the results file : create a new 'ExodusIIReader'
solveExo = ExodusIIReader(FileName=solveexoFileAddress)

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()

# only load the data that is needed
solveExo.PointVariables = cellsarrays