Skip to content

Commit

Permalink
update op2.rdnas2cam to handle Path objects
Browse files Browse the repository at this point in the history
  • Loading branch information
twmacro committed Oct 9, 2023
1 parent c843e39 commit 39d7539
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions pyyeti/nastran/op2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2875,10 +2875,12 @@ def rdmats(filename=None, names=None, lower=False, verbose=False):
def _get_op2_op4(op2file, op4file):
if op2file is None: # pragma: no cover
op2file = guitools.get_file_name(None, read=True)
elif not os.path.exists(op2file):
op2file = op2file + ".op2"
if not op4file:
op4file = op2file.replace(".op2", ".op4")
else:
op2file = os.fspath(op2file)
if not os.path.exists(op2file):
op2file = op2file + ".op2"
if not op4file:
op4file = op2file.replace(".op2", ".op4")
return op2file, op4file


Expand Down
3 changes: 2 additions & 1 deletion pyyeti/tests/test_op2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import re
import tempfile
from pathlib import Path
import numpy as np
import pandas as pd
from pyyeti import ytools, nastran, locate
Expand Down Expand Up @@ -45,7 +46,7 @@ def runcomp(nas, m):


def test_n2c_csuper():
nas = op2.rdnas2cam("pyyeti/tests/nas2cam_csuper/nas2cam")
nas = op2.rdnas2cam(Path("pyyeti/tests/nas2cam_csuper/nas2cam"))
# nas.keys()
# dict_keys(['rfmodes', 'fgravh', 'lambda', 'phg', 'dnids', 'nrb',
# 'maps', 'kaa', 'cstm', 'maa', 'fgravg', 'uset', 'selist', 'upids',
Expand Down

0 comments on commit 39d7539

Please sign in to comment.