Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return AnalyticBeam(model, **to_set)
path = beam_model # beam_model = path to beamfits
uvb = UVBeam()
if use_shared_mem and (mpi.world_comm is not None):
if mpi.rank == 0:
uvb.read_beamfits(path)
uvb.peak_normalize()
for key, attr in uvb.__dict__.items():
if not isinstance(attr, parameter.UVParameter):
continue
if key == '_data_array':
uvb.__dict__[key].value = mpi.shared_mem_bcast(attr.value, root=0)
else:
uvb.__dict__[key].value = mpi.world_comm.bcast(attr.value, root=0)
mpi.world_comm.Barrier()
else:
uvb.read_beamfits(path)
for key, val in self.uvb_params.items():
setattr(uvb, key, val)
uvb.extra_keywords['beam_path'] = path
return uvb
# Get list of attributes that are set.
isset = None
if mpi.rank == root:
isset = [key for key, value in self.__dict__.items() if value is not None]
isset = mpi.world_comm.bcast(isset, root=root)
for key in isset:
attr = getattr(self, key)
if key in self.put_in_shared:
val = mpi.shared_mem_bcast(attr, root=root)
else:
val = mpi.world_comm.bcast(attr, root=root)
if val is not None:
setattr(self, key, val)
mpi.world_comm.Barrier()