Bonjour tous le monde.
j’aimerais savoir s’il existe un moyen de convertir un np.array en ufl. J’en ai besoin pour le projecter dans un espace de fonction.
merci d’avance pour votre aide.
un extrait du code:
Mh1 = FunctionSpace(mesh3, P12)
I4f1 = inner(f01, E_out1 * f01)
I4f11 = project(I4f1,Mh1)
I4f111 = np.array(I4f11.vector())
### hilbert transform ####
im_I1 = np.imag(hilbert2(I4f111))
r_I1 = np.real(hilbert2(I4f111))
PH1 = project(np.arctan(im_I1/r_I1),Mh1)
AM1 = project ((im_I1**2+r_I1**2)**0.5,Mh1)
I have the following error.
ufl.log.UFLValueError: Invalid type conversion: [[ 1.57073722 1.57021749 1.57040617 1.56843488 1.56973472 1.56643423
1.56896551 1.56555684 1.56899562 1.55090886 1.56425717 1.53243787
1.56745704 1.55792053 1.56876535 0.94090225 1.52773487 0.9977159
1.53468148 -1.27512584 1.56699534 -1.55738644 1.56924163 -1.5702078
1.0478015 -1.02568609 1.22021917 -1.32489794 1.50502088 -1.55033121
1.56391166 1.57044341 -1.57019304 -1.57052695 -0.90565318 -1.57040799
-0.54346908 -0.48537103 0.6835119 -1.15603898 0.97328087 -1.55865028
-1.56566246 -1.57079566 -1.56542658 -1.5706531 -1.56943593 -1.5704638
-0.1471946 1.25547389 0.20918702 1.42199656 -0.67474811 1.55724698
-1.56448427 -1.56324497 -1.56040751 -1.56812617 -1.56264603 -1.55667831
-1.56885723 -1.56848191 -1.5699468 -1.19916903 -1.5706108 -0.41933631
0.69237835 1.2720099 1.43488067 1.54366177 -1.56621239 1.55405021
1.47359874 1.47481035 1.50863242 1.48079876 1.54203298 -1.48488143
1.56189615 -1.56668644 1.47626401 -1.52436288 -0.20954633 0.82124713
1.14184567 1.3163255 1.54372384 1.4118422 1.29483438 0.62097153
1.24100497 1.00432834 1.42523366 -1.18306962 1.52210946 -1.56151785
-1.08539557 -1.57013113 -0.28051408 0.70041215 0.99295126 -0.68091119
0.8173392 -1.447112 -0.95665044 -0.91871426 -0.06246736 0.18037061
0.9341108 -1.22558773 -0.84120473 -1.55938942 -1.56183872 -1.57010119
1.51271111 1.55548121 -1.37979241 -1.31056101 -0.56499637 -0.63949099
-0.38254558 -1.42520975 -1.51402999 1.55921153 -1.38386978 -1.20059628
-0.76694737 -0.3381174 0.68236788 1.24376141 1.0962757 -1.5045341
0.12698094]] can not be converted to any UFL type.