Skip to content

various bugs in adjoint solver #1405

@oskooi

Description

@oskooi

The following four bugs were discovered using pylint.

  1. self.frequencies and self.monitor should be initialized to None.

class EigenmodeCoefficient(ObjectiveQuantitiy):
def __init__(self,sim,volume,mode,forward=True,kpoint_func=None,**kwargs):
'''
'''
self.sim = sim
self.volume=volume
self.mode=mode
self.forward = 0 if forward else 1
self.normal_direction = None
self.kpoint_func = kpoint_func
self.eval = None
self.EigenMode_kwargs = kwargs
return

same for:

class FourierFields(ObjectiveQuantitiy):
def __init__(self,sim,volume, component):
self.sim = sim
self.volume=volume
self.eval = None
self.component = component

and:

class Near2FarFields(ObjectiveQuantitiy):
def __init__(self,sim,Near2FarRegions, far_pt):
self.sim = sim
self.Near2FarRegions=Near2FarRegions
self.eval = None
self.far_pt = far_pt
return

  1. == should be replaced with =:

k0 == direction_scalar * mp.Vector3(z=1)

  1. There are two return statements rather than one:

return np.exp(-1j*2*np.pi*f0*t)
return np.where(n.any() < 0.0 or n.any() > self.N,0,np.exp(-1j*2*np.pi*f0*t))

  1. eta is not defined:

case1 = eta*npa.exp(-beta*(eta-x)/eta) - (eta-x)*npa.exp(-beta)
case2 = 1 - (1-eta)*npa.exp(-beta*(x-eta)/(1-eta)) - (eta-x)*npa.exp(-beta)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions