Skip to content

Commit

Permalink
move logging warning to user warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ig-dolci committed May 21, 2024
1 parent 908b636 commit 5d845e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyadjoint/control.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .overloaded_type import OverloadedType, create_overloaded_object
import logging
import warnings


class Control(object):
Expand Down Expand Up @@ -47,13 +47,13 @@ def tape_value(self):

def get_derivative(self, options={}):
if self.block_variable.adj_value is None:
logging.warning("Adjoint value is None, is the functional independent of the control variable?")
warnings.warn("Adjoint value is None, is the functional independent of the control variable?")
return self.control._ad_convert_type(0., options=options)
return self.control._ad_convert_type(self.block_variable.adj_value, options=options)

def get_hessian(self, options={}):
if self.block_variable.adj_value is None:
logging.warning("Hessian value is None, is the functional independent of the control variable?")
warnings.warn("Hessian value is None, is the functional independent of the control variable?")
return self.control._ad_convert_type(0., options=options)
return self.control._ad_convert_type(self.block_variable.hessian_value, options=options)

Expand Down

0 comments on commit 5d845e6

Please sign in to comment.