Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fixes #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sequence_jacobian/blocks/solved_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _steady_state(self, calibration, dissolve, options, **kwargs):
unknowns = {k: v for k, v in calibration.items() if k in self.unknowns}
else:
unknowns = self.unknowns
if 'solver' not in kwargs:
if not kwargs['solver']:
# TODO: replace this with default option
kwargs['solver'] = self.solver

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def __call__(self, index):
return self

def apply(self, f, **kwargs):
kwargs.update({arg: kwargs[arg].f_value for arg in kwargs if isinstance(kwargs[arg], AccumulatedDerivative)})
return ignore(f(numeric_primitive(self), **kwargs))

def __pos__(self):
Expand Down
2 changes: 1 addition & 1 deletion src/sequence_jacobian/hetblocks/hh_twoasset.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ def lhs_equals_rhs_interpolate(lhs, rhs, iout, piout):
err_upper = rhs[i, j] - lhs[i]
err_lower = rhs[i - 1, j] - lhs[i - 1]
piout[j] = err_upper / (err_upper - err_lower)


6 changes: 5 additions & 1 deletion src/sequence_jacobian/utilities/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def output_list(f):
Important to write functions in this way when they will be scanned by output_list, for
either SimpleBlock or HetBlock.
"""
return OrderedSet(re.findall('return (.*?)\n', inspect.getsource(f))[-1].replace(' ', '').split(','))
source = inspect.getsource(f)
source_no_comments = re.sub(r'(?m)^ *#.*\n?', '', source)
return_statements = re.findall('return (.*?)\n', source_no_comments)

return OrderedSet(return_statements[0].replace(' ', '').split(','))


def metadata(f):
Expand Down