Commit 60c160ff authored by Duggan, John's avatar Duggan, John
Browse files

Remove rho assumption

parent 11804961
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
[project]
name = "ips-fastran-gui"
version = "0.2.4"
version = "0.2.5"
description = "IPS Fastran GUI Project"
authors = []
readme = "README.md"
+12 −7
Original line number Diff line number Diff line
"""Fastran Plotter."""

import os
import sys
from pathlib import Path
from typing import Any, Dict

@@ -46,15 +45,21 @@ class PlotFastran:
                p = self.ax[i_plot, j_plot]
                for key in define:
                    print(pannel, key)

                    # Pull x from the variable's dimensions rather than assuming rho
                    y_variable = self.fastran.variables[key[0]]
                    try:
                        x = self.fastran.variables["rho"][:]
                        y = self.fastran.variables[key[0]][key[1], :]
                        p.plot(x, y, key[2])
                    except Exception as err:
                        x_dimension = y_variable.dimensions[1]
                    except IndexError:
                        print(
                            f"Error encountered while plotting file {self.filename} {pannel} {key}: {str(err)}",
                            file=sys.stderr,
                            "skipping", pannel, key[0], "due to invalid number of dimensions (expected two, found one)"
                        )
                        continue
                    x_variable = self.fastran.variables[x_dimension]

                    x = x_variable[:]
                    y = y_variable[key[1], :]
                    p.plot(x, y, key[2])

                p.set_title(pannel)
                p.set_xlim(0, 1)