Skip to content

Commit

Permalink
Fix keq not accepting index (thanks to a bug report from the forums)
Browse files Browse the repository at this point in the history
Bumped version number
  • Loading branch information
Immudzen committed Sep 29, 2021
1 parent 2a13351 commit 5a4e3d8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CADETMatch.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ProjectTypeGuids>{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids>
<LaunchProvider>Standard Python launcher</LaunchProvider>
<InterpreterId>CondaEnv|CondaEnv|pymoo_devel</InterpreterId>
<CommandLineArguments>"F:\cadet_release_test\search\mcmc\stage2\non.json" 12</CommandLineArguments>
<CommandLineArguments>"C:\Users\kosh\Downloads\cadetmatch_test\ds_cex.json" 12</CommandLineArguments>
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
<SuppressConfigureTestFrameworkPrompt>true</SuppressConfigureTestFrameworkPrompt>
<InterpreterArguments>
Expand Down
57 changes: 39 additions & 18 deletions CADETMatch/transform/auto_keq.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,25 @@ def setSimulation(self, sim, seq, experiment):
):
location = self.parameter["location"]

comp = self.parameter["component"]
bound = self.parameter["bound"]

unit = self.getUnit(location[0])
boundOffset = util.getBoundOffset(sim.root.input.model[unit])

position = boundOffset[comp] + bound
sim[location[0].lower()][position] = values[0]
sim[location[1].lower()][position] = values[1]
try:
comp = self.parameter["component"]
bound = self.parameter["bound"]
index = None
except KeyError:
index = self.parameter["index"]
bound = None

if bound is not None:
unit = self.getUnit(location[0])
boundOffset = util.getBoundOffset(sim.root.input.model[unit])

position = boundOffset[comp] + bound
sim[location[0].lower()][position] = values[0]
sim[location[1].lower()][position] = values[1]

if index is not None:
sim[location[0].lower()][index] = values[0]
sim[location[1].lower()][index] = values[1]

return values, headerValues

Expand Down Expand Up @@ -188,25 +198,36 @@ def getHeaders(self):
location = self.parameter["location"]
nameKA = location[0].rsplit("/", 1)[-1]
nameKD = location[1].rsplit("/", 1)[-1]
bound = self.parameter["bound"]
comp = self.parameter["component"]
bound = self.parameter.get("bound", None)
index = self.parameter.get("index", None)
comp = self.parameter.get("comp", None)

headers = []
headers.append("%s Comp:%s Bound:%s" % (nameKA, comp, bound))
headers.append("%s Comp:%s Bound:%s" % (nameKD, comp, bound))
headers.append("%s/%s Comp:%s Bound:%s" % (nameKA, nameKD, comp, bound))
if bound is not None:
headers.append("%s Comp:%s Bound:%s" % (nameKA, comp, bound))
headers.append("%s Comp:%s Bound:%s" % (nameKD, comp, bound))
headers.append("%s/%s Comp:%s Bound:%s" % (nameKA, nameKD, comp, bound))
if index is not None:
headers.append("%s Comp:%s Index:%s" % (nameKA, comp, index))
headers.append("%s Comp:%s Index:%s" % (nameKD, comp, index))
headers.append("%s/%s Comp:%s Index:%s" % (nameKA, nameKD, comp, index))
return headers

def getHeadersActual(self):
location = self.parameter["location"]
nameKA = location[0].rsplit("/", 1)[-1]
nameKD = location[1].rsplit("/", 1)[-1]
bound = self.parameter["bound"]
comp = self.parameter["component"]
bound = self.parameter.get("bound", None)
index = self.parameter.get("index", None)
comp = self.parameter.get("comp", None)

headers = []
headers.append("%s Comp:%s Bound:%s" % (nameKA, comp, bound))
headers.append("%s/%s Comp:%s Bound:%s" % (nameKA, nameKD, comp, bound))
if bound is not None:
headers.append("%s Comp:%s Bound:%s" % (nameKA, comp, bound))
headers.append("%s/%s Comp:%s Bound:%s" % (nameKA, nameKD, comp, bound))
if index is not None:
headers.append("%s Comp:%s Index:%s" % (nameKA, comp, index))
headers.append("%s/%s Comp:%s Index:%s" % (nameKA, nameKD, comp, index))
return headers

def setBounds(self, parameter, lb, ub):
Expand Down
2 changes: 1 addition & 1 deletion CADETMatch/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
__email__ = "[email protected]"
__license__ = "GNU General Public License v3 (GPLv3)"
__copyright__ = "2020 %s" % __author__
__version__ = "0.8.9"
__version__ = "0.8.10"
__uri__ = "https://github.com/modsim/CADET-Match"

0 comments on commit 5a4e3d8

Please sign in to comment.