MCPcopy Create free account
hub / github.com/NanoComp/meep / convert

Method convert

python/mpb_data.py:316–339  ·  view source on GitHub ↗
(self, arr, kpoint=None)

Source from the content-addressed store, hash-verified

314 self.cart_map = cart_map
315
316 def convert(self, arr, kpoint=None):
317 if isinstance(arr, MPBArray):
318 self.lattice = arr.lattice
319 self.kpoint = arr.kpoint
320
321 if self.lattice is None:
322 err = (
323 "Couldn't find 'lattice.' You must do one of the following:\n"
324 + " 1. Pass the ModeSolver lattice to the MPBData constructor\n"
325 + " i.e., MPBData(lattice=ms.get_lattice())\n"
326 + " 2. Create an MPBArray to pass to MPBData.convert()\n"
327 + " i.e., mpb_arr = MPBArray(arr, ms.get_lattice(), ... ); mpb_data.convert(mpb_arr))"
328 )
329 raise ValueError(err)
330
331 if kpoint:
332 self.kpoint = kpoint
333
334 self.init_output_lattice()
335
336 if len(arr.shape) == 4:
337 return self.handle_cvector_dataset(arr, not arr.bloch_phase)
338 else:
339 return self.handle_dataset(arr)

Callers 6

test_diamondMethod · 0.95
test_tri_rodsMethod · 0.95
test_handle_cvectorMethod · 0.95
tri_rodsFunction · 0.95
diamondFunction · 0.95

Calls 3

init_output_latticeMethod · 0.95
handle_datasetMethod · 0.95

Tested by 4

test_diamondMethod · 0.76
test_tri_rodsMethod · 0.76
test_handle_cvectorMethod · 0.76