Running postprocessing on multiple results
Posted: Sun May 16, 2021 7:49 pm
Dear STKO Team,
I am currently running the same postprocessing script on multiple output databases generated by STKO for different accelerograms.
The general form of the instructions is:
1. OpneDatabase --> App.runCommand("OpenDatabase", "RECORDERS.mpco")
2. Instructions --> runpy.run_path(path_name='POST_PROCESSING_FILE.py')
3. CloseDatabase -->doc.removeDatabase(db)
I can successfully open the database, run the instructions and close the database once.
However, I am unable to repeat this sequence of instructions more than once. In fact, after the first time, the software crashes. I think this is due to the import of modules multiple times?
Can you please help me with this issue?
Thank you in advance for your help.
Best wishes,
Raffaele
STRUCTURE OF THE CODE: - The Green Line is the line that does not work.
from PyMpc import *
from os import chdir
import runpy
App.clearTerminal()
chdir('ACC_1')
App.runCommand("OpenDatabase", "RECORDERS_PART_1.mpco")
doc = App.postDocument()
doc.clearPlotGroups()
doc.clearCharts()
doc.clearChartData()
doc.commitChanges()
doc.dirty = True
doc.select(None)
runpy.run_path(path_name='POST_PROCESSING_FINAL_PART_1.py')
db = doc.getDatabase(1)
doc.removeDatabase(db)
App.setBusy(False)
App.clearTerminal()
App.runCommand("OpenDatabase", "RECORDERS_PART_2.mpco")
doc = App.postDocument()
doc.clearPlotGroups()
doc.clearCharts()
doc.clearChartData()
doc.commitChanges()
doc.dirty = True
doc.select(None)
runpy.run_path(path_name='POST_PROCESSING_FINAL_PART_2.py')
db = doc.getDatabase(1)
doc.removeDatabase(db)
App.setBusy(False)
chdir("..")
I am currently running the same postprocessing script on multiple output databases generated by STKO for different accelerograms.
The general form of the instructions is:
1. OpneDatabase --> App.runCommand("OpenDatabase", "RECORDERS.mpco")
2. Instructions --> runpy.run_path(path_name='POST_PROCESSING_FILE.py')
3. CloseDatabase -->doc.removeDatabase(db)
I can successfully open the database, run the instructions and close the database once.
However, I am unable to repeat this sequence of instructions more than once. In fact, after the first time, the software crashes. I think this is due to the import of modules multiple times?
Can you please help me with this issue?
Thank you in advance for your help.
Best wishes,
Raffaele
STRUCTURE OF THE CODE: - The Green Line is the line that does not work.
from PyMpc import *
from os import chdir
import runpy
App.clearTerminal()
chdir('ACC_1')
App.runCommand("OpenDatabase", "RECORDERS_PART_1.mpco")
doc = App.postDocument()
doc.clearPlotGroups()
doc.clearCharts()
doc.clearChartData()
doc.commitChanges()
doc.dirty = True
doc.select(None)
runpy.run_path(path_name='POST_PROCESSING_FINAL_PART_1.py')
db = doc.getDatabase(1)
doc.removeDatabase(db)
App.setBusy(False)
App.clearTerminal()
App.runCommand("OpenDatabase", "RECORDERS_PART_2.mpco")
doc = App.postDocument()
doc.clearPlotGroups()
doc.clearCharts()
doc.clearChartData()
doc.commitChanges()
doc.dirty = True
doc.select(None)
runpy.run_path(path_name='POST_PROCESSING_FINAL_PART_2.py')
db = doc.getDatabase(1)
doc.removeDatabase(db)
App.setBusy(False)
chdir("..")