diff --git a/404.html b/404.html index 20fb3e8..fd7c278 100644 --- a/404.html +++ b/404.html @@ -12,7 +12,7 @@ - + @@ -20,10 +20,10 @@ - + - + @@ -66,6 +66,9 @@
Class for openPMD External Field Mesh data.
Initialized on on openPMD beamphysics particle group:
.expand_onaxis
pmd_beamphysics/fields/fieldmesh.py
42 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 41 + 42 43 44 45 @@ -2315,8 +2183,7 @@ Fields 757 758 759 -760 -761class FieldMesh: +760class FieldMesh: """ Class for openPMD External Field Mesh data. @@ -2723,7 +2590,7 @@ Fields """ if frequency is None: - raise ValueError(f"Please provide a frequency") + raise ValueError("Please provide a frequency") data = read_ansys_ascii_3d_fields(efile, hfile, frequency=frequency) return cls(data=data) @@ -3037,9 +2904,9 @@ Fields memloc = hex(id(self)) return f'<FieldMesh with {self.geometry} geometry and {self.shape} shape at {memloc}>' - + + - @@ -3054,8 +2921,8 @@ Fields - axis_labels - + axis_labels + property @@ -3063,10 +2930,10 @@ - - + + - + @@ -3075,8 +2942,8 @@ - coord_vecs - + coord_vecs + property @@ -3084,10 +2951,10 @@ - - + + Uses gridSpacing, gridSize, and gridOriginOffset to return coordinate vectors. - +
41 + 42 43 44 45 @@ -2315,8 +2183,7 @@ Fields 757 758 759 -760 -761
class FieldMesh: +760
class FieldMesh: """ Class for openPMD External Field Mesh data. @@ -2723,7 +2590,7 @@ Fields """ if frequency is None: - raise ValueError(f"Please provide a frequency") + raise ValueError("Please provide a frequency") data = read_ansys_ascii_3d_fields(efile, hfile, frequency=frequency) return cls(data=data) @@ -3037,9 +2904,9 @@ Fields memloc = hex(id(self)) return f'<FieldMesh with {self.geometry} geometry and {self.shape} shape at {memloc}>'
axis_labels
property
coord_vecs
Uses gridSpacing, gridSize, and gridOriginOffset to return coordinate vectors.
factor
factor to multiply fields by, possibly complex.
factor = scale * exp(i*phase)
is_pure_electric
Returns True if there are no non-zero mageneticField components
is_pure_magnetic
Returns True if there are no non-zero electricField components
meshgrid
Usses coordinate vectors to produce a standard numpy meshgrids.
phase
writable
Returns the complex argument phi = -2*pi*RFphase to multiply the oscillating field by.
phi = -2*pi*RFphase
Can be set.
__eq__(other)
Checks that all attributes and component internal data are the same
565 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 564 +565 566 567 568 569 570 571 -572 -573def __eq__(self, other): +572def __eq__(self, other): """ Checks that all attributes and component internal data are the same """ @@ -3237,24 +3102,22 @@ return tools.data_are_equal(self.components, other.components) - -
564 +565 566 567 568 569 570 571 -572 -573
def __eq__(self, other): +572
def __eq__(self, other): """ Checks that all attributes and component internal data are the same """ @@ -3237,24 +3102,22 @@ return tools.data_are_equal(self.components, other.components)
__getitem__(key)
Returns component data from a key
If the key starts with:
the appropriate numpy operator is applied.
713 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 712 +713 714 715 716 @@ -3304,8 +3168,7 @@ 748 749 750 -751 -752def __getitem__(self, key): +751def __getitem__(self, key): """ Returns component data from a key @@ -3346,24 +3209,22 @@ return dat - -
712 +713 714 715 716 @@ -3304,8 +3168,7 @@ 748 749 750 -751 -752
def __getitem__(self, key): +751
def __getitem__(self, key): """ Returns component data from a key @@ -3346,24 +3209,22 @@ return dat
axis_index(key)
Returns axis index for a named axis label key.
Examples:
.axis_index('z')
2
214 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 213 +214 215 216 217 @@ -3384,8 +3246,7 @@ 222 223 224 -225 -226def axis_index(self, key): +225def axis_index(self, key): """ Returns axis index for a named axis label key. @@ -3399,115 +3260,107 @@ return i raise ValueError(f'Axis not found: {key}') - -
213 +214 215 216 217 @@ -3384,8 +3246,7 @@ 222 223 224 -225 -226
def axis_index(self, key): +225
def axis_index(self, key): """ Returns axis index for a named axis label key. @@ -3399,115 +3260,107 @@ return i raise ValueError(f'Axis not found: {key}')
component_is_zero(key)
Returns True if all elements in a component are zero.
295 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 294 +295 296 297 298 -299 -300def component_is_zero(self, key): +299def component_is_zero(self, key): """ Returns True if all elements in a component are zero. """ a = self[key] return not np.any(a) - -
294 +295 296 297 298 -299 -300
def component_is_zero(self, key): +299
def component_is_zero(self, key): """ Returns True if all elements in a component are zero. """ a = self[key] return not np.any(a)
coord_vec(key)
Gets the coordinate vector from a named axis key.
235 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 234 +235 236 237 238 -239 -240def coord_vec(self, key): +239def coord_vec(self, key): """ Gets the coordinate vector from a named axis key. """ i = self.axis_index(key) return np.linspace(self.mins[i], self.maxs[i], self.shape[i]) - -
234 +235 236 237 238 -239 -240
def coord_vec(self, key): +239
def coord_vec(self, key): """ Gets the coordinate vector from a named axis key. """ i = self.axis_index(key) return np.linspace(self.mins[i], self.maxs[i], self.shape[i])
copy()
Returns a deep copy
755 -756 -757
def copy(self): + + Source code in pmd_beamphysics/fields/fieldmesh.py + 754 +755 +756def copy(self): """Returns a deep copy""" return deepcopy(self) - -
754 +755 +756
def copy(self): """Returns a deep copy""" return deepcopy(self)
from_ansys_ascii_3d(*, efile=None, hfile=None, frequency=None)
classmethod
Class method to return a FieldMesh from ANSYS ASCII files.
The format of each file is: header1 (ignored) @@ -3528,19 +3381,22 @@
Filename with complex magnetic H field data in A/m
Frequency in Hz
FieldMesh
416 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 415 +416 417 418 419 @@ -3575,8 +3431,7 @@ Parameters448 449 450 -451 -452@classmethod +451@classmethod def from_ansys_ascii_3d(cls, *, efile = None, hfile = None, @@ -3609,24 +3464,22 @@ Parameters """ if frequency is None: - raise ValueError(f"Please provide a frequency") + raise ValueError("Please provide a frequency") data = read_ansys_ascii_3d_fields(efile, hfile, frequency=frequency) return cls(data=data) - -
415 +416 417 418 419 @@ -3575,8 +3431,7 @@ Parameters448 449 450 -451 -452
@classmethod +451
@classmethod def from_ansys_ascii_3d(cls, *, efile = None, hfile = None, @@ -3609,24 +3464,22 @@ Parameters """ if frequency is None: - raise ValueError(f"Please provide a frequency") + raise ValueError("Please provide a frequency") data = read_ansys_ascii_3d_fields(efile, hfile, frequency=frequency) return cls(data=data)
from_astra_3d(common_filename, frequency=0)
Class method to parse multiple 3D astra fieldmap files, based on the common filename.
456 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 455 +456 457 458 459 460 461 462 -463 -464@classmethod +463@classmethod def from_astra_3d(cls, common_filename, frequency=0): """ Class method to parse multiple 3D astra fieldmap files, @@ -3659,19 +3512,17 @@ data = read_astra_3d_fieldmaps(common_filename, frequency=frequency) return cls(data=data) - -
455 +456 457 458 459 460 461 462 -463 -464
@classmethod +463
@classmethod def from_astra_3d(cls, common_filename, frequency=0): """ Class method to parse multiple 3D astra fieldmap files, @@ -3659,19 +3512,17 @@ data = read_astra_3d_fieldmaps(common_filename, frequency=frequency) return cls(data=data)
from_onaxis(*, z=None, Bz=None, Ez=None, frequency=0, harmonic=None, eleAnchorPt='beginning')
z: array z-coordinates. Must be regularly spaced.
magnetic field at r=0 in T Default: None
Electric field at r=0 in V/m Default: None
fundamental frequency in Hz. Default: 0
Harmonic of the fundamental the field actually oscillates at. Default: 1 if frequency !=0, otherwise 0.
Element anchor point. @@ -3714,9 +3570,10 @@
field: FieldMesh Instantiated fieldmesh
466 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 465 +466 467 468 469 @@ -3803,8 +3660,7 @@ Parameters 550 551 552 -553 -554@classmethod +553@classmethod def from_onaxis(cls, *, z=None, Bz=None, @@ -3894,19 +3750,17 @@ Parameters data = dict(attrs=attrs, components=components) return cls(data=data) - -
465 +466 467 468 469 @@ -3803,8 +3660,7 @@ Parameters 550 551 552 -553 -554
@classmethod +553
@classmethod def from_onaxis(cls, *, z=None, Bz=None, @@ -3894,19 +3750,17 @@ Parameters data = dict(attrs=attrs, components=components) return cls(data=data)
from_superfish(filename, type=None, geometry='cylindrical')
Class method to parse a superfish T7 style file.
405 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 404 +405 406 407 408 409 410 411 -412 -413@classmethod +412@classmethod @functools.wraps(read_superfish_t7) def from_superfish(cls, filename, type=None, geometry='cylindrical'): """ @@ -3938,30 +3792,29 @@ c = cls(data=data) return c - -
404 +405 406 407 408 409 410 411 -412 -413
@classmethod +412
@classmethod @functools.wraps(read_superfish_t7) def from_superfish(cls, filename, type=None, geometry='cylindrical'): """ @@ -3938,30 +3792,29 @@ c = cls(data=data) return c
scaled_component(key)
Retruns a component scaled by the complex factor factor = scaleexp(iphase)
596 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 595 +596 597 598 599 @@ -3988,8 +3841,7 @@ 620 621 622 -623 -624def scaled_component(self, key): +623def scaled_component(self, key): """ Retruns a component scaled by the complex factor @@ -4019,31 +3871,30 @@ else: return dat - -
595 +596 597 598 599 @@ -3988,8 +3841,7 @@ 620 621 622 -623 -624
def scaled_component(self, key): +623
def scaled_component(self, key): """ Retruns a component scaled by the complex factor @@ -4019,31 +3871,30 @@ else: return dat
to_cylindrical()
Returns a new FieldMesh in cylindrical geometry.
If the current geometry is rectangular, this will use the y=0 slice.
368 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 367 +368 369 370 371 @@ -4055,8 +3906,7 @@ 377 378 379 -380 -381def to_cylindrical(self): +380def to_cylindrical(self): """ Returns a new FieldMesh in cylindrical geometry. @@ -4071,29 +3921,28 @@ else: raise NotImplementedError(f"geometry not implemented: {self.geometry}") - -
367 +368 369 370 371 @@ -4055,8 +3906,7 @@ 377 378 379 -380 -381
def to_cylindrical(self): +380
def to_cylindrical(self): """ Returns a new FieldMesh in cylindrical geometry. @@ -4071,29 +3921,28 @@ else: raise NotImplementedError(f"geometry not implemented: {self.geometry}")
units(key)
Returns the units of any key
323 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 322 +323 324 325 326 @@ -4102,8 +3951,7 @@ 329 330 331 -332 -333def units(self, key): +332def units(self, key): """Returns the units of any key""" # Strip any operators @@ -4115,29 +3963,28 @@ return pg_units(key) - -
322 +323 324 325 326 @@ -4102,8 +3951,7 @@ 329 330 331 -332 -333
def units(self, key): +332
def units(self, key): """Returns the units of any key""" # Strip any operators @@ -4115,29 +3963,28 @@ return pg_units(key)
write(h5, name=None)
Writes openPMD-beamphysics format to an open h5 handle, or new file if h5 is a str.
336 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 335 +336 337 338 339 @@ -4149,8 +3996,7 @@ 345 346 347 -348 -349def write(self, h5, name=None): +348def write(self, h5, name=None): """ Writes openPMD-beamphysics format to an open h5 handle, or new file if h5 is a str. @@ -4165,65 +4011,62 @@ write_pmd_field(g, self.data, name=name) - -
335 +336 337 338 339 @@ -4149,8 +3996,7 @@ 345 346 347 -348 -349
def write(self, h5, name=None): +348
def write(self, h5, name=None): """ Writes openPMD-beamphysics format to an open h5 handle, or new file if h5 is a str. @@ -4165,65 +4011,62 @@ write_pmd_field(g, self.data, name=name)
write_gpt(filePath, asci2gdf_bin=None, verbose=True)
Writes a GPT field file.
384 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 383 +384 385 386 387 -388 -389def write_gpt(self, filePath, asci2gdf_bin=None, verbose=True): +388def write_gpt(self, filePath, asci2gdf_bin=None, verbose=True): """ Writes a GPT field file. """ return write_gpt_fieldmesh(self, filePath, asci2gdf_bin=asci2gdf_bin, verbose=verbose) - -
383 +384 385 386 387 -388 -389
def write_gpt(self, filePath, asci2gdf_bin=None, verbose=True): +388
def write_gpt(self, filePath, asci2gdf_bin=None, verbose=True): """ Writes a GPT field file. """ return write_gpt_fieldmesh(self, filePath, asci2gdf_bin=asci2gdf_bin, verbose=verbose)
write_superfish(filePath, verbose=False)
Write a Superfish T7 file.
For static fields, a Poisson T7 file is written.
For dynamic (harmonic /= 0) fields, a Fish T7 file is written
harmonic /= 0
392 + + Source code in pmd_beamphysics/fields/fieldmesh.py + 391 +392 393 394 395 @@ -4231,8 +4074,7 @@ 397 398 399 -400 -401@functools.wraps(write_superfish_t7) +400@functools.wraps(write_superfish_t7) def write_superfish(self, filePath, verbose=False): """ Write a Superfish T7 file. @@ -4243,8 +4085,8 @@ """ return write_superfish_t7(self, filePath, verbose=verbose) - -
391 +392 393 394 395 @@ -4231,8 +4074,7 @@ 397 398 399 -400 -401
@functools.wraps(write_superfish_t7) +400
@functools.wraps(write_superfish_t7) def write_superfish(self, filePath, verbose=False): """ Write a Superfish T7 file. @@ -4243,8 +4085,8 @@ """ return write_superfish_t7(self, filePath, verbose=verbose)