first debug on metapeg. At the moment there is only one frequency being optimized. Although we are not using the epigraph yet, it would still be convenient to still consider a small range around the central frequency and optimize the average objective between them. This would still be better than considering only one frequency, but for the moment I need to understand if this model can work or not. Before running a full batch, more debugging is required to better understand how everything works. In this release, the code has not been tested in the results part, but the main optimization function run a couple of rounds without throwing errors. We still need to assure the normalization we make on the far fields is reasonable or not. The next step is to run a dummy simulation until the end and observe the results generation works, then the true test would be to let it run a true optimization with the right resolution.

This commit is contained in:
2026-05-13 22:43:54 +02:00
parent 1101a53d3a
commit af4c538b36
3 changed files with 541 additions and 41 deletions
+2 -1
View File
@@ -196,13 +196,14 @@
" )\n",
"]\n",
"#mpa.Near2FarFields return a numpy array with shape (num_of_points,nfreq,6) where the \n",
"#third axis are the field components Ex,Ey,Ez,Hx,Hy,Hz\n",
"#third axis are the field components Ex (0),Ey (1),Ez (2),Hx (3),Hy (4),Hz (5)\n",
"FarFields = mpa.Near2FarFields(sim, NearRegions, far_z)\n",
"ob_list = [FarFields]\n",
"\n",
"#this the objective to function\n",
"#the objective is to maximize the obj function,\n",
"def J1(FF):\n",
" #the far fields are passed directly by the opt object (which knows them through the ob_list)\n",
" #in this case we want to maximize field intensity\n",
" # at the position of the focal spot \n",
" obj_to_return = npa.mean(npa.abs(FF[0,:,0]) ** 2)\n",