@@ -51,6 +51,7 @@ def get_susceptibilities(*sources, susceptibility=None):
5151 raise ValueError ("susceptibility is not scalar or array fo length 3" )
5252 return susceptibilities
5353
54+
5455def get_H_ext (* sources , H_ext = None ):
5556 """Return a list of length (len(sources)) with H_ext values
5657 Priority is given at the source level, hovever if value is not found, it is searched up the
@@ -61,8 +62,8 @@ def get_H_ext(*sources, H_ext=None):
6162 H_ext = getattr (src , "H_ext" , None )
6263 if H_ext is None :
6364 if src .parent is None :
64- #print("Warning: No value for H_ext defined in any parent collection. H_ext set to zero.")
65- H_exts .append ((0.0 ,0.0 ,0.0 ))
65+ # print("Warning: No value for H_ext defined in any parent collection. H_ext set to zero.")
66+ H_exts .append ((0.0 , 0.0 , 0.0 ))
6667 else :
6768 H_exts .extend (get_H_ext (src .parent ))
6869 else :
@@ -370,19 +371,17 @@ def apply_demag(
370371 raise ValueError (
371372 "Apply_demag input collection and susceptibility must have same length."
372373 )
373- susceptibility = np .reshape (
374- susceptibility , 3 * n , order = "F"
375- )
374+ susceptibility = np .reshape (susceptibility , 3 * n , order = "F" )
376375 S = np .diag (susceptibility ) # shape ii, jj
377376
378377 # set up H_ext
379378 H_ext = get_H_ext (* magnets_list )
380379 H_ext = np .array (H_ext )
381380 if len (H_ext ) != n :
382- raise ValueError ("Apply_demag input collection and H_ext must have same length." )
383- H_ext = np . reshape (
384- H_ext , ( 3 * n , 1 ), order = "F"
385- )
381+ raise ValueError (
382+ "Apply_demag input collection and H_ext must have same length."
383+ )
384+ H_ext = np . reshape ( H_ext , ( 3 * n , 1 ), order = "F" )
386385
387386 # set up T (3 pol unit, n cells, n positions, 3 Bxyz)
388387 with timelog ("Demagnetization tensor calculation" , min_log_time = min_log_time ):
0 commit comments