451 def displayRtcMatrix(self) -> None:
452 if not self.sim.is_init:
458 type_matrix = str(self.uiExpert.wao_selectRtcMatrix.currentText())
460 type_matrix ==
"imat" and
461 self.sim.config.p_controllers[0].type != scons.ControllerType.GENERIC
463 self.sim.config.p_controllers[0].type != scons.ControllerType.GEO):
464 data = self.sim.rtc.get_imat(0)
465 elif (type_matrix ==
"cmat"):
466 data = self.sim.rtc.get_cmat(0)
467 elif (type_matrix ==
"Eigenvalues"):
468 if (self.sim.config.p_controllers[0].type == scons.ControllerType.LS
or
469 self.sim.config.p_controllers[0].type == scons.
471 data = self.sim.rtc.getEigenvals(0)
472 elif (type_matrix ==
"Cmm" and
473 self.sim.config.p_controllers[0].type == scons.ControllerType.MV):
474 tmp = self.sim.rtc.get_cmm(0)
475 ao.do_tomo_matrices(0, self.sim.rtc, self.sim.config.p_wfss,
476 self.sim.dms, self.sim.atm, self.sim.wfs,
477 self.sim.config.p_rtc, self.sim.config.p_geom,
478 self.sim.config.p_dms, self.sim.config.p_tel,
479 self.sim.config.p_atmos)
480 data = self.sim.rtc.get_cmm(0)
481 self.sim.rtc.set_cmm(0, tmp)
482 elif (type_matrix ==
"Cmm inverse" and
483 self.sim.config.p_controllers[0].type ==
"mv"):
484 data = self.sim.rtc.get_cmm(0)
485 elif (type_matrix ==
"Cmm eigen" and
486 self.sim.config.p_controllers[0].type ==
"mv"):
487 data = self.sim.rtc.getCmmEigenvals(0)
488 elif (type_matrix ==
"Cphim" and
489 self.sim.config.p_controllers[0].type ==
"mv"):
490 data = self.sim.rtc.get_cphim(0)
492 if (data
is not None):
493 self.uiExpert.wao_rtcWindow.canvas.axes.clear()
494 ax = self.uiExpert.wao_rtcWindow.canvas.axes
495 if (len(data.shape) == 2):
496 self.uiExpert.wao_rtcWindow.canvas.axes.matshow(
497 data, aspect=
"auto", origin=
"lower", cmap=
"gray")
498 elif (len(data.shape) == 1):
500 self.uiExpert.wao_rtcWindow.canvas.axes.plot(
501 list(range(len(data))), data, color=
"black")
503 if (type_matrix ==
"Eigenvalues"):
514 self.uiExpert.wao_rtcWindow.canvas.axes.grid(which=
'both')
517 self.uiExpert.wao_rtcWindow.canvas.axes.grid(
518 which=
'minor', alpha=0.2)
519 self.uiExpert.wao_rtcWindow.canvas.axes.grid(
520 which=
'major', alpha=0.5)
521 nfilt = self.sim.rtc.get_nfiltered(0, self.sim.config.p_rtc)
522 self.uiExpert.wao_rtcWindow.canvas.axes.plot([
523 nfilt - 0.5, nfilt - 0.5
524 ], [data.min(), data.max()], color=
"red", linestyle=
"dashed")
526 self.uiExpert.wao_rtcWindow.canvas.axes.scatter(
527 np.arange(0, nfilt, 1), data[0:nfilt], color=
"red"
529 self.uiExpert.wao_rtcWindow.canvas.axes.scatter(
530 np.arange(nfilt, len(data),
531 1), data[nfilt:], color=
"blue"
533 tt =
"%d modes Filtered" % nfilt
535 ax.text(0.5, 0.2, tt, horizontalalignment=
'center',
536 verticalalignment=
'center', transform=ax.transAxes)
538 self.uiExpert.wao_rtcWindow.canvas.draw()