You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to loop over the coverpoint bins to get the individual values. How to do it correctly?
` model = vsc.get_coverage_report_model()
# Build a value matrix for each coverpoint
self.vmatrix = {}
for covergroup_name, covergroup in model.covergroup_m.items():
print(f"Covergroup: {covergroup_name}")
# Iterate through each coverpoint in the covergroup
for coverpoint in covergroup.coverpoints:
print(f" Coverpoint: {coverpoint.name}")
# Iterate through each bin in the coverpoint
for bin in coverpoint.bins:
print(f" Bin: {bin.name}, Count: {bin.count}")
# Extract the value of the coverpoint for this bin (What's a better approach here ???)
bin_name = bin.name.split('[')[0]
bin_name = coverpoint.name[0:-len("_cp")]
bin_value = int(bin.name.split('[')[1].split(']')[0])
# Add the bin value to the value matrix
self.vmatrix[bin_name] = self.vmatrix.get(bin_name, [])
self.vmatrix[bin_name].append(bin_value)
`
The bin_values seem to be the number of the bin, when I print self.vmatrix:
{'lnms_num_points': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
I want it to be:
'lnms_num_points': [0,195,108,11,730,1247,1195,1029,4484,5904]}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have this code ...
`import vsc
import itertools
@vsc.randobj
class RandObj(object):
def init(self):
`
I am trying to loop over the coverpoint bins to get the individual values. How to do it correctly?
` model = vsc.get_coverage_report_model()
`
The bin_values seem to be the number of the bin, when I print self.vmatrix:
{'lnms_num_points': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}
I want it to be:
'lnms_num_points': [0,195,108,11,730,1247,1195,1029,4484,5904]}
How to get the actual bin value being counted?
Beta Was this translation helpful? Give feedback.
All reactions