Skip to content
Snippets Groups Projects

make BudgetItem.freq a property

Merged Kevin Kuns requested to merge kevin.kuns/pygwinc:BudgetItem-freq into master
3 unresolved threads

This makes BudgetItem frequency arrays properties instead of attributes. As an attribute, BudgetItem.freq can be set directly but this doesn't update the precomp cache or any of the frequency arrays of the cal_objs and noise_objs for instances of Budget. This is a problem if run is called without any keyword arguments after changing freq. Now that freq is a property, the setter clears the precomp cache and recurses through the cal_objs and noise_objs if applicable.

So this works correctly now

traces1 = budget.run(freq=freq1)
budget.freq = freq2
traces2 = budget.run()

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
53 53 np.log10(float(fspec[2])),
54 54 int(fspec[1]),
55 55 )
56 except (ValueError, IndexError):
56 except (ValueError, IndexError, AttributeError):
  • how do you think an AttributeError would be raised here? this should only ever be called on strings, and I don't think any of their attributes are relevant to the parsing here.

  • Author Maintainer

    If spec is not np.ndarray and is not None, then spec is not a string when entering the try block. spec.split(':') raises an AttributeError in this case. This was also previously the case and I fixed it this way when updating the rest of the frequency specification. This could also be solved by adding an else case after the case that spec is None. Open to other suggestions.

  • Please register or sign in to reply
  • 498 511 logger.debug("load {}".format(item))
    499 512 item.load()
    500 513
    501 def update(self, _precomp=None, **kwargs):
    514 def update(self, **kwargs):
  • Lee McCuller approved this merge request

    approved this merge request

  • Lee McCuller mentioned in commit 8356c3d9

    mentioned in commit 8356c3d9

  • merged

  • Please register or sign in to reply
    Loading