code: def test_to_lisrel(self):
      demo = SEMGraph(
          ebunch=[
              ("xi1", "x1", 1.000),
              ("xi1", "x2", 2.180),
              ("xi1", "x3", 1.819),
              ("xi1", "eta1", 1.483),
              ("eta1", "y1", 1.000),
              ("eta1", "y2", 1.257),
              ("eta1", "y3", 1.058),
              ("eta1", "y4", 1.265),
              ("eta1", "eta2", 0.837),
              ("xi1", "eta2", 0.572),
              ("eta2", "y5", 1.000),
              ("eta2", "y6", 1.186),
              ("eta2", "y7", 1.280),
              ("eta2", "y8", 1.266),
          ],
          latents=["xi1", "eta1", "eta2"],
          err_corr=[
              ("y1", "y5", 0.624),
              ("y2", "y6", 2.153),
              ("y2", "y4", 1.313),
              ("y3", "y7", 0.795),
              ("y4", "y8", 0.348),
              ("y6", "y8", 1.356),
          ],
          err_var={
              "x1": 0.082,
              "x2": 0.120,
              "x3": 0.467,
              "y1": 1.891,
              "y2": 7.373,
              "y3": 5.067,
              "y4": 3.148,
              "y5": 2.351,
              "y6": 4.954,
              "y7": 3.431,
              "y8": 3.254,
              "xi1": 0.448,
              "eta1": 3.956,
              "eta2": 0.172,
          },
      )
      demo_lisrel = demo.to_lisrel()
  
      indexing = []
      vars_ordered = [
          "y1",
          "y2",
          "y3",
          "y4",
          "y5",
          "y6",
          "y7",
          "y8",
          "x1",
          "x2",
          "x3",
          "xi1",
          "eta1",
          "eta2",
      ]
      for var in vars_ordered:
          indexing.append(demo_lisrel.eta.index(var))
  
      eta_reorder = [demo_lisrel.eta[i] for i in indexing]
  
      B_reorder = demo_lisrel.B[indexing, :][:, indexing]
      B_fixed_reorder = demo_lisrel.B_fixed_mask[indexing, :][
          :, indexing
      ]
  
      zeta_reorder = demo_lisrel.zeta[indexing, :][:, indexing]
      zeta_fixed_reorder = demo_lisrel.zeta_fixed_mask[indexing, :][
          :, indexing
      ]
  
      wedge_y_reorder = demo_lisrel.wedge_y[:, indexing]
  
      self.assertEqual(vars_ordered, eta_reorder)
      npt.assert_array_equal(
          B_reorder,
          np.array(
              [
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
              ]
          ),
      )
  
      npt.assert_array_equal(
          zeta_reorder,
          np.array(
              [
                  [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
                  [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
                  [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
                  [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
              ]
          ),
      )
  
      npt.assert_array_equal(
          B_fixed_reorder,
          np.array(
              [
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.257, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.058, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.265, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.186],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.280],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.266],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.000, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2.180, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.819, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.483, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.572, 0.837, 0],
              ]
          ),
      )
  
      npt.assert_array_equal(
          zeta_fixed_reorder,
          np.array(
              [
                  [1.891, 0, 0, 0, 0.624, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [
                      0,
                      7.373,
                      0,
                      1.313,
                      0,
                      2.153,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                  ],
                  [0, 0, 5.067, 0, 0, 0, 0.795, 0, 0, 0, 0, 0, 0, 0],
                  [
                      0,
                      1.313,
                      0,
                      3.148,
                      0,
                      0,
                      0,
                      0.348,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                  ],
                  [0.624, 0, 0, 0, 2.351, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [
                      0,
                      2.153,
                      0,
                      0,
                      0,
                      4.954,
                      0,
                      1.356,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                  ],
                  [0, 0, 0.795, 0, 0, 0, 3.431, 0, 0, 0, 0, 0, 0, 0],
                  [
                      0,
                      0,
                      0,
                      0.348,
                      0,
                      1.356,
                      0,
                      3.254,
                      0,
                      0,
                      0,
                      0,
                      0,
                      0,
                  ],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0.082, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0.120, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.467, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.448, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.956, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.172],
              ]
          ),
      )
  
      npt.assert_array_equal(
          demo_lisrel.wedge_y,
          np.array(
              [
                  [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
                  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
              ]
          ),
      )
  
imports: import os
  import unittest
  import networkx
  import numpy
  import numpy.testing
  from pgmpy.models import SEM, SEMAlg, SEMGraph
label_desc: Use image node_id 8 for calling the TestSEMGraph obj's underlying member method code with example usage: obj.test_to_lisrel() without return types