Skip to content

Commit

Permalink
Cler outputs, select correct file
Browse files Browse the repository at this point in the history
  • Loading branch information
rhinoella committed Jun 17, 2024
1 parent b602dd6 commit 0807979
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
12 changes: 8 additions & 4 deletions gudpy/core/gudpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ def gudrun(
gudrunFile.OUTPATH
)

gudrunFile.clearOutputs()

deps = self.obtainDependencies(gudrunFile)
for dep in deps:
shutil.copyfile(
Expand Down Expand Up @@ -667,6 +669,8 @@ def iterate(self, purge) -> typ.Tuple[int, str]:
self.exitcode = (exitcode, gudrunNC.error)
return self.exitcode

newCenterGudFile = self.gudrunFile.runSamples()[0].gudFile

# Run the current center
currentCenter = self.iterator.iterateCurrentCenter(
self.gudrunFile, sampleArg)
Expand All @@ -678,13 +682,13 @@ def iterate(self, purge) -> typ.Tuple[int, str]:
self.exitcode = (exitcode, gudrunCC.error)
return self.exitcode

currentCenterGudFile = self.gudrunFile.runSamples()[0].gudFile

# Compare the cost of the two centers
self.iterator.compareCost(
sampleArg=sampleArg,
currentCenterGudFile=gudrunCC.sampleArg[
"background"].samples[0].dataFiles[0].gudFile,
newCenterGudFile=gudrunNC.sampleArg[
"background"].samples[0].dataFiles[0].gudFile
currentCenterGudFile=currentCenterGudFile,
newCenterGudFile=newCenterGudFile
)

# Check if result has been achieved
Expand Down
9 changes: 9 additions & 0 deletions gudpy/core/gudrun_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ def __deepcopy__(self, memo):
setattr(result, k, deepcopy(v, memo))
return result

def clearOutputs(self):
self.outputFolder = ""
for sbg in self.sampleBackgrounds:
sbg.outputFolder = ""
for sample in self.runSamples():
for df in sample.dataFiles:
df._outputs = {}
df.outputFolder = ""

def setGudrunDir(self, dir):
self.instrument.GudrunInputFileDir = dir

Expand Down
2 changes: 1 addition & 1 deletion gudpy/core/iterators.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def setSelfScatteringFiles(self, scale, gudrunFile):
for sample in sampleBackground.samples:
if sample.runThisSample and len(sample.dataFiles):
if scale == Scales.Q:
targetFile = sample.dataFiles[0].mdcsFile
targetFile = sample.dataFiles[0].msubwFile
else:
targetFile = sample.dataFiles[0].mintFile
sample.fileSelfScattering = (
Expand Down
4 changes: 2 additions & 2 deletions gudpy/gui/widgets/core/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,11 +833,11 @@ def handleContainerPlotModeChanged(self, index):
self.ui.bottomContainerPlotFrame.setVisible(False)
self.ui.containerPlotSplitter.setSizes([1, 0])

@ abstractmethod
@abstractmethod
def isPlotModeSplittable(self, plotMode):
return plotMode in SPLIT_PLOTS.keys()

@ abstractmethod
@abstractmethod
def splitPlotMode(self, plotMode):
return SPLIT_PLOTS[plotMode]

Expand Down

0 comments on commit 0807979

Please sign in to comment.