@@ -481,11 +481,13 @@ def grid_corrected_copy(self) -> ElectromagneticFieldData:
481
481
@property
482
482
def intensity (self ) -> ScalarFieldDataArray :
483
483
"""Return the sum of the squared absolute electric field components."""
484
+ normal_dim = "xyz" [self .monitor .size .index (0 )]
484
485
fields = self ._colocated_fields
485
486
components = ("Ex" , "Ey" , "Ez" )
486
487
if any (cmp not in fields for cmp in components ):
487
488
raise KeyError ("Can't compute intensity, all E field components must be present." )
488
- return sum (fields [cmp ].abs ** 2 for cmp in components )
489
+ intensity = sum (fields [cmp ].abs ** 2 for cmp in components )
490
+ return intensity .squeeze (dim = normal_dim , drop = True )
489
491
490
492
@property
491
493
def poynting (self ) -> ScalarFieldDataArray :
@@ -524,8 +526,7 @@ def mode_area(self) -> FreqModeDataArray:
524
526
525
527
Effective mode area is calculated as: (∫|E|²dA)² / (∫|E|⁴dA)
526
528
"""
527
- normal_dim = "xyz" [self .monitor .size .index (0 )]
528
- intensity = self .intensity .squeeze (dim = normal_dim , drop = True )
529
+ intensity = self .intensity
529
530
# integrate over the plane
530
531
d_area = self ._diff_area
531
532
num = (intensity * d_area ).sum (dim = d_area .dims ) ** 2
@@ -1324,7 +1325,7 @@ def to_dataframe(self) -> DataFrame:
1324
1325
dataset = self .modes_info
1325
1326
drop = []
1326
1327
1327
- if np .all (dataset ["group index" ] == None ):
1328
+ if not np .any (dataset ["group index" ]. values ):
1328
1329
drop .append ("group index" )
1329
1330
if np .all (dataset ["loss (dB/cm)" ] == 0 ):
1330
1331
drop .append ("loss (dB/cm)" )
0 commit comments