7
7
import numpy as np
8
8
import pydantic .v1 as pd
9
9
10
- from tidy3d .components .base import skip_if_fields_missing
11
10
from tidy3d .components .data .data_array import (
12
11
DataArray ,
13
12
IndexedFieldVoltageDataArray ,
29
28
from tidy3d .components .types import TYPE_TAG_STR , Ax , annotate_type
30
29
from tidy3d .components .viz import add_ax_if_none
31
30
from tidy3d .exceptions import DataError
32
- from tidy3d .log import log
33
31
34
32
FieldDataset = Union [
35
33
SpatialDataArray , annotate_type (Union [TriangularGridDataset , TetrahedralGridDataset ])
@@ -58,28 +56,6 @@ def field_components(self) -> dict[str, DataArray]:
58
56
"""Maps the field components to their associated data."""
59
57
return {"potential" : self .potential }
60
58
61
- @pd .validator ("potential" , always = True )
62
- @skip_if_fields_missing (["monitor" ])
63
- def warn_no_data (cls , val , values ):
64
- """Warn if no data provided."""
65
-
66
- mnt = values .get ("monitor" )
67
-
68
- if val is None :
69
- log .warning (
70
- f"No data is available for monitor '{ mnt .name } '. This is typically caused by "
71
- "monitor not intersecting any solid medium."
72
- )
73
-
74
- return val
75
-
76
- @property
77
- def symmetry_expanded_copy (self ) -> SteadyPotentialData :
78
- """Return copy of self with symmetry applied."""
79
-
80
- new_potential = self ._symmetry_expanded_copy (property = self .potential )
81
- return self .updated_copy (potential = new_potential , symmetry = (0 , 0 , 0 ))
82
-
83
59
def field_name (self , val : str ) -> str :
84
60
"""Gets the name of the fields to be plotted."""
85
61
if val == "abs^2" :
@@ -143,35 +119,6 @@ def check_correct_data_type(cls, values):
143
119
144
120
return values
145
121
146
- @pd .root_validator (skip_on_failure = True )
147
- def warn_no_data (cls , values ):
148
- """Warn if no data provided."""
149
-
150
- mnt = values .get ("monitor" )
151
- electrons = values .get ("electrons" )
152
- holes = values .get ("holes" )
153
-
154
- if electrons is None or holes is None :
155
- log .warning (
156
- f"No data is available for monitor '{ mnt .name } '. This is typically caused by "
157
- "monitor not intersecting any solid medium."
158
- )
159
-
160
- return values
161
-
162
- @property
163
- def symmetry_expanded_copy (self ) -> SteadyFreeCarrierData :
164
- """Return copy of self with symmetry applied."""
165
-
166
- new_electrons = self ._symmetry_expanded_copy (property = self .electrons )
167
- new_holes = self ._symmetry_expanded_copy (property = self .holes )
168
-
169
- return self .updated_copy (
170
- electrons = new_electrons ,
171
- holes = new_holes ,
172
- symmetry = (0 , 0 , 0 ),
173
- )
174
-
175
122
def field_name (self , val : str = "" ) -> str :
176
123
"""Gets the name of the fields to be plotted."""
177
124
if val == "abs^2" :
@@ -259,42 +206,6 @@ def check_correct_data_type(cls, values):
259
206
260
207
return values
261
208
262
- @pd .root_validator (skip_on_failure = True )
263
- def warn_no_data (cls , values ):
264
- """Warn if no data provided."""
265
-
266
- mnt = values .get ("monitor" )
267
- fields = ["Ec" , "Ev" , "Ei" , "Efn" , "Efp" ]
268
- for field_name in fields :
269
- field_data = values .get (field_name )
270
-
271
- if field_data is None :
272
- log .warning (
273
- f"No data is available for monitor '{ mnt .name } '. This is typically caused by "
274
- "monitor not intersecting any solid medium."
275
- )
276
-
277
- return values
278
-
279
- @property
280
- def symmetry_expanded_copy (self ) -> SteadyEnergyBandData :
281
- """Return copy of self with symmetry applied."""
282
-
283
- new_Ec = self ._symmetry_expanded_copy (property = self .Ec )
284
- new_Ev = self ._symmetry_expanded_copy (property = self .Ev )
285
- new_Ei = self ._symmetry_expanded_copy (property = self .Ei )
286
- new_Efn = self ._symmetry_expanded_copy (property = self .Efn )
287
- new_Efp = self ._symmetry_expanded_copy (property = self .Efp )
288
-
289
- return self .updated_copy (
290
- Ec = new_Ec ,
291
- Ev = new_Ev ,
292
- Ei = new_Ei ,
293
- Efn = new_Efn ,
294
- Efp = new_Efp ,
295
- symmetry = (0 , 0 , 0 ),
296
- )
297
-
298
209
def field_name (self , val : str = "" ) -> str :
299
210
"""Gets the name of the fields to be plotted."""
300
211
if val == "abs^2" :
@@ -418,25 +329,15 @@ class SteadyCapacitanceData(HeatChargeMonitorData):
418
329
)
419
330
# C_n = electron_capacitance
420
331
421
- @pd .validator ("hole_capacitance" , always = True )
422
- @skip_if_fields_missing (["monitor" ])
423
- def warn_no_data (cls , val , values ):
424
- """Warn if no data provided."""
425
-
426
- mnt = values .get ("monitor" )
427
-
428
- if val is None :
429
- log .warning (
430
- f"No data is available for monitor '{ mnt .name } '. This is typically caused by "
431
- "monitor not intersecting any solid medium."
432
- )
433
-
434
- return val
435
-
436
332
def field_name (self , val : str ) -> str :
437
333
"""Gets the name of the fields to be plotted."""
438
334
return ""
439
335
336
+ @property
337
+ def field_components (self ) -> dict [str , UnstructuredFieldType ]:
338
+ """Maps the field components to their associated data."""
339
+ return {}
340
+
440
341
@property
441
342
def symmetry_expanded_copy (self ) -> SteadyCapacitanceData :
442
343
"""Return copy of self with symmetry applied."""
@@ -494,21 +395,6 @@ def field_components(self) -> dict[str, UnstructuredFieldType]:
494
395
"""Maps the field components to their associated data."""
495
396
return {"E" : self .E }
496
397
497
- @pd .root_validator (skip_on_failure = True )
498
- def warn_no_data (cls , values ):
499
- """Warn if no data provided."""
500
-
501
- mnt = values .get ("monitor" )
502
- E = values .get ("E" )
503
-
504
- if E is None :
505
- log .warning (
506
- f"No data is available for monitor '{ mnt .name } '. This is typically caused by "
507
- "monitor not intersecting any solid medium."
508
- )
509
-
510
- return values
511
-
512
398
@pd .root_validator (skip_on_failure = True )
513
399
def check_correct_data_type (cls , values ):
514
400
"""Issue error if incorrect data type is used"""
@@ -526,17 +412,6 @@ def check_correct_data_type(cls, values):
526
412
527
413
return values
528
414
529
- @property
530
- def symmetry_expanded_copy (self ) -> SteadyElectricFieldData :
531
- """Return copy of self with symmetry applied."""
532
-
533
- new_E = self ._symmetry_expanded_copy (property = self .E )
534
-
535
- return self .updated_copy (
536
- E = new_E ,
537
- symmetry = (0 , 0 , 0 ),
538
- )
539
-
540
415
def field_name (self , val : str = "" ) -> str :
541
416
"""Gets the name of the fields to be plotted."""
542
417
if val == "abs^2" :
@@ -569,21 +444,6 @@ def field_components(self) -> dict[str, UnstructuredFieldType]:
569
444
"""Maps the field components to their associated data."""
570
445
return {"J" : self .J }
571
446
572
- @pd .root_validator (skip_on_failure = True )
573
- def warn_no_data (cls , values ):
574
- """Warn if no data provided."""
575
-
576
- mnt = values .get ("monitor" )
577
- J = values .get ("J" )
578
-
579
- if J is None :
580
- log .warning (
581
- f"No data is available for monitor '{ mnt .name } '. This is typically caused by "
582
- "monitor not intersecting any solid medium."
583
- )
584
-
585
- return values
586
-
587
447
@pd .root_validator (skip_on_failure = True )
588
448
def check_correct_data_type (cls , values ):
589
449
"""Issue error if incorrect data type is used"""
@@ -601,17 +461,6 @@ def check_correct_data_type(cls, values):
601
461
602
462
return values
603
463
604
- @property
605
- def symmetry_expanded_copy (self ) -> SteadyCurrentDensityData :
606
- """Return copy of self with symmetry applied."""
607
-
608
- new_J = self ._symmetry_expanded_copy (property = self .J )
609
-
610
- return self .updated_copy (
611
- J = new_J ,
612
- symmetry = (0 , 0 , 0 ),
613
- )
614
-
615
464
def field_name (self , val : str = "" ) -> str :
616
465
"""Gets the name of the fields to be plotted."""
617
466
if val == "abs^2" :
0 commit comments