Hilbert transform in UFL

Dear community
I solved a finite element problem on a cubic domain with FEniCs. To find certain quantities, I had to interpolate the solution on the mid-plane of the z-axis (thus on the mid-surface). the objective was to be able to perform the HILBERT transform in 2D of the solution obtained on this surface. After getting the solution, I turned it into a numpy array so I could use the hilbert2 function which is contained in the scipy library. only, after using this method, I realize that the NUMPY results are no longer compatible with the UFL language. I have tried ways to leave numpy to UFL without success. I also tried to project the solutions coming from numpy into a FunctionSpace but no results.
please i would like to know if there is any way to convert numpy array to UFL language? or, does UFL have a way to do the Hilbert transform?
Thank you in advance.
I will attach to this request a piece of my 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’ve the following conersion 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.

There is a fundamental difference in what UFL and numpy offer. UFL is a symbolic algebra package designed for specifying abstract finite element formulations which are then interpreted by FFCx which generates code facilitating numeric computation with DOLFINx.

A similar relationship is that between sympy and numpy. sympy is a symbolic algebra library, and numpy is a library facilitating numerical computation.

Hopefully now you’ll see that attempting to project an array of numerical values to a function space does not make sense. However, you could carefully use those numbers to define a finite element function which could then be projected onto an appropriate space.

Dear Nate,
thank you for your answer. I learned a lot. your last sentence says.

I have been trying to do this and would like to know if you were referring to this.
Thanks for enlightening me more. and I would also like to know how to project such a function.
Thanks in advance.
here is the code.

PH1 = Function(Mh1)
PH1_numpy = np.arctan(im_I1/r_I1)
PH1.vector().get_local()[:] = PH1_numpy