Skip to content

Commit

Permalink
Fixed a syntax error with fractionations related to the unit change
Browse files Browse the repository at this point in the history
Renamed scoop_match.py to __main__.py to make it easier to run
Now you can use python -m CADETMatch --match -j /path/to/file.json
  • Loading branch information
Immudzen committed Sep 24, 2019
1 parent 5ee3f95 commit 901e089
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CADETMatch.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ README.md
setup.cfg
setup.py
CADETMatch/__init__.py
CADETMatch/__main__.py
CADETMatch/autocorr.py
CADETMatch/cache.py
CADETMatch/calc_coeff.py
Expand All @@ -25,7 +26,6 @@ CADETMatch/nsga2_simple.py
CADETMatch/nsga3_selection.py
CADETMatch/pareto.py
CADETMatch/plugins.py
CADETMatch/scoop_match.py
CADETMatch/score.py
CADETMatch/similarityDecay.py
CADETMatch/synthetic_error.py
Expand Down
5 changes: 3 additions & 2 deletions CADETMatch/CADETMatch.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<LaunchProvider>Standard Python launcher</LaunchProvider>
<CommandLineArguments>"F:\temp\example\fit\example.json" 2</CommandLineArguments>
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging>
<InterpreterArguments>-m scoop -n 6</InterpreterArguments>
<InterpreterArguments>
</InterpreterArguments>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -95,7 +96,7 @@
<Compile Include="plugins.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="scoop_match.py">
<Compile Include="__main__.py">
<SubType>Code</SubType>
</Compile>
<Compile Include="score.py">
Expand Down
8 changes: 6 additions & 2 deletions CADETMatch/scoop_match.py → CADETMatch/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ def makeParser():
action='store_true')

parser.add_argument('-n',
help="Number of scoop processes to use. Use 1 for debugging")
help="Number of scoop processes to use. Use 1 for debugging",
default=0)

return parser


def run_command(module, json, number_of_jobs, additional=None):
command = [sys.executable, '-m', 'scoop', '-n', str(number_of_jobs), module.__file__, str(json)]
command = [sys.executable, '-m', 'scoop']
if int(number_of_jobs) > 0:
command.extend(['-n', str(number_of_jobs)])
command.extend([module.__file__, str(json)])
if additional is not None:
command.extend(additional)

Expand Down
2 changes: 1 addition & 1 deletion CADETMatch/scores/fractionation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def run(sim_data, feature):
selected = (times >= start) & (times <= stop)

local_times = times[selected]
local_values = simulation.root.output.solution[feature['unit']["solution_outlet_comp_%03d" % component][selected]
local_values = simulation.root.output.solution[feature['unit']]["solution_outlet_comp_%03d" % component][selected]

sim_value = numpy.trapz(local_values, local_times)

Expand Down
2 changes: 1 addition & 1 deletion CADETMatch/scores/fractionationCombine.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def run(sim_data, feature):
selected = (times >= start) & (times <= stop)

local_times = times[selected]
local_values = simulation.root.output.solution[feature['unit']["solution_outlet_comp_%03d" % component][selected]
local_values = simulation.root.output.solution[feature['unit']]["solution_outlet_comp_%03d" % component][selected]

sim_value = numpy.trapz(local_values, local_times)

Expand Down
2 changes: 1 addition & 1 deletion CADETMatch/scores/fractionationMeanVariance.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def run(sim_data, feature):
for (start, stop, component, values, func_mean_time, func_variance_time, func_mean_value, func_variance_value) in funcs:
time_center = (start + stop)/2.0

sim_values = util.fractionate(start, stop, times, simulation.root.output.solution[feature['unit']["solution_outlet_comp_%03d" % component])
sim_values = util.fractionate(start, stop, times, simulation.root.output.solution[feature['unit']]["solution_outlet_comp_%03d" % component])

mean_sim_time, variance_sim_time, skew_sim_time, mean_sim_value, variance_sim_value, skew_sim_value = util.fracStat(time_center, sim_values)

Expand Down
2 changes: 1 addition & 1 deletion CADETMatch/scores/fractionationMoment.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def run(sim_data, feature):
for (start, stop, component, values, func_mean_time, func_variance_time, func_skew_time, func_mean_value, func_variance_value, func_skew_value) in funcs:
time_center = (start + stop)/2.0

sim_values = util.fractionate(start, stop, times, simulation.root.output.solution[feature['unit']["solution_outlet_comp_%03d" % component])
sim_values = util.fractionate(start, stop, times, simulation.root.output.solution[feature['unit']]["solution_outlet_comp_%03d" % component])

mean_sim_time, variance_sim_time, skew_sim_time, mean_sim_value, variance_sim_value, skew_sim_value = util.fracStat(time_center, sim_values)

Expand Down
2 changes: 1 addition & 1 deletion CADETMatch/scores/fractionationSlide.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def run(sim_data, feature):

for component, value_func in funcs:
exp_values = numpy.array(data[str(component)])
sim_value = simulation.root.output.solution[feature['unit']["solution_outlet_comp_%03d" % component]
sim_value = simulation.root.output.solution[feature['unit']]["solution_outlet_comp_%03d" % component]

rollLeft, rollRight, searchMax = rollRange(times, sim_value, searchIndexStart, searchIndexStop)

Expand Down

0 comments on commit 901e089

Please sign in to comment.