diff options
-rwxr-xr-x | bin/merge.py | 12 | ||||
-rw-r--r-- | lib/Kratos/DFADriver.pm | 2 | ||||
-rw-r--r-- | lib/Kratos/DFADriver/Model.pm | 16 |
3 files changed, 29 insertions, 1 deletions
diff --git a/bin/merge.py b/bin/merge.py index b66ceed..9a71d62 100755 --- a/bin/merge.py +++ b/bin/merge.py @@ -970,6 +970,8 @@ def analyze(by_name, by_arg, by_param, by_trace, parameters): aggdata = { 'state' : {}, 'transition' : {}, + 'min_voltage' : min_voltage, + 'max_voltage' : max_voltage, } transition_names = list(map(lambda x: x[0], filter(lambda x: x[1]['isa'] == 'transition', by_name.items()))) for name, val in by_name.items(): @@ -1081,12 +1083,20 @@ if 'voltage' in opts: 'arg_name' : None, } +min_voltage = float(data['setup']['mimosa_voltage']) +max_voltage = float(data['setup']['mimosa_voltage']) + parameters = sorted(data['model']['parameter'].keys()) for arg in args: mdata = load_json(arg) + this_voltage = float(mdata['setup']['mimosa_voltage']) + if this_voltage > max_voltage: + max_voltage = this_voltage + if this_voltage < min_voltage: + min_voltage = this_voltage if 'voltage' in opts: - opts['voltage'] = float(mdata['setup']['mimosa_voltage']) + opts['voltage'] = this_voltage for runidx, run in enumerate(mdata['traces']): if 'ignore-trace-idx' not in opts or opts['ignore-trace-idx'] != runidx: for i, elem in enumerate(run['trace']): diff --git a/lib/Kratos/DFADriver.pm b/lib/Kratos/DFADriver.pm index 321860d..83a572f 100644 --- a/lib/Kratos/DFADriver.pm +++ b/lib/Kratos/DFADriver.pm @@ -644,6 +644,8 @@ sub update_model { } } + $self->model->set_voltage($self->{log}{aggregate}{min_voltage}, $self->{log}{aggregate}{max_voltage}); + $self->model->save; } diff --git a/lib/Kratos/DFADriver/Model.pm b/lib/Kratos/DFADriver/Model.pm index ef821e7..18bccfe 100644 --- a/lib/Kratos/DFADriver/Model.pm +++ b/lib/Kratos/DFADriver/Model.pm @@ -412,6 +412,22 @@ sub set_transition_params { } } +sub set_voltage { + my ($self, $min_voltage, $max_voltage) = @_; + + my ($data_node) = $self->xml->findnodes('/data'); + + for my $voltage_node ($data_node->findnodes('./voltage')) { + $data_node->removeChild($voltage_node); + } + + my $voltage_node = XML::LibXML::Element->new('voltage'); + $voltage_node->setAttribute('min', $min_voltage); + $voltage_node->setAttribute('max', $max_voltage); + + $data_node->appendChild($voltage_node); +} + sub save { my ($self) = @_; |