Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyyeti/nastran/bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _check_for_symbols(rel_path, symbols):
"""
index = rel_path.find(":")
# if a colon is found in position 1, assume this is a Windows absolute path
if index >= 2: #
if index >= 2:
symbol = rel_path[0:index].lower()
rel_path = rel_path[index + 1 :]
try:
Expand Down Expand Up @@ -777,7 +777,7 @@ def rdcards(
for symbol in include_symbols:
if not len(symbol) > 2:
raise ValueError(f"Symbols must have a length >1, got {symbol}")

kwargsReturnType = "list" if return_var == "list" else "array"
kwargs = { # save args for use in _rdinclude
"name": name,
Expand Down Expand Up @@ -1402,7 +1402,7 @@ def _recs_to_df(recs):
dof = rec[j + 1]
j += 2
val = rec[j : j + ints_per_number]
val.dtype = dtype
val = val.view(dtype)
j += ints_per_number
ri = np.searchsorted(r_id_dof, nid * 10 + dof)
mat[ri, ci] = val[0]
Expand Down
10 changes: 5 additions & 5 deletions pyyeti/nastran/op2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ def rdop2opg(self, name="OPG1"):
loadset_id = ident[4]
n_grids = data.shape[0] // numwde
grid_ids = np.frombuffer(data, self._endian + "i4")[::numwde] // 10
data.shape = (n_grids, numwde)
data = data.reshape((n_grids, numwde), copy=False)
forces = data[:, 2:]
output[loadset_id] = pd.DataFrame(
forces, index=grid_ids, columns=[1, 2, 3, 4, 5, 6]
Expand Down Expand Up @@ -1313,7 +1313,7 @@ def _rdop2oug(self, name):
# id*10, type, x, y, z, rx, ry, rz
# - type == 1 for grids; those have all 6 dof
id_dof = data.reshape(-1, 8)[:, :2]
id_dof.dtype = np.int32
id_dof = id_dof.view(np.int32)
pvgrids = id_dof[:, 1] == 1
full_dof = _expanddof(id_dof[:, 0] // 10, pvgrids)
indexm = pd.MultiIndex.from_tuples(
Expand All @@ -1329,7 +1329,7 @@ def _rdop2oug(self, name):
eigenval = np.empty(ncols, np.float32)

oug[:, col] = data[V]
ident.dtype = np.float32
ident = ident.view(np.float32)
eigenval[col] = ident[5]
col += 1

Expand Down Expand Up @@ -1718,7 +1718,7 @@ def _rdop2ougv1(self, name):
V[pvgrids, 3:] = True # only grids have all 6
V = V.ravel()
# initialize ougv1 with first mode shape:
data.dtype = np.float32 # reinterpret as floats
data = data.view(np.float32) # reinterpret as floats
ougv1 = data[V].reshape(-1, 1)
else:
data = self.rdop2record("single", V.shape[0])
Expand Down Expand Up @@ -3026,7 +3026,7 @@ def _getdrm(pos, e, s, eids, etypes, ibytes):
if drm is None:
drm, elem_info = _getdrm(pos, e, s, eids, etypes, self._ibytes)
drm[:, mode - 1] = column
drm.dtype = np.float32 if self._ibytes == 4 else np.float64
drm = drm.view(np.float32) if self._ibytes == 4 else drm.view(np.float64)
if oldstyle:
return drm, elem_info

Expand Down
18 changes: 9 additions & 9 deletions pyyeti/nastran/op4.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def _put_binary_values_c(X, r, c, Y):
if not isinstance(Y, np.ndarray):
Y = np.array(Y)
Y = Y.astype("float", copy=False)
Y.dtype = complex
Y = Y.view(complex)
X[r : r + len(Y), c] = Y

@staticmethod
Expand Down Expand Up @@ -1265,7 +1265,7 @@ def _write_col_data(f, v, c, s, elems, perline, numform):
e = pv[-1]
elems = (e - s + 1) * multiplier
v = np.asarray(v[s : e + 1]).ravel()
v.dtype = float
v = v.view(float)
_write_col_data(f, v, c, s, elems, perline, numform)
else:
# sparse matrix:
Expand All @@ -1279,7 +1279,7 @@ def _write_col_data(f, v, c, s, elems, perline, numform):
vec = np.zeros(elems, dt)
vec[rs[pv] - s] = vs[pv]
elems *= multiplier
vec.dtype = float
vec = vec.view(float)
_write_col_data(f, vec, c, s, elems, perline, numform)
f.write(f"{cols + 1:8}{1:8}{1:8}\n")
f.write(numform % 2**0.5)
Expand All @@ -1305,7 +1305,7 @@ def _write_ascii_sparse(
_write_col_header(f, ind, c, multiplier)
for r0, r1 in ind:
string = v[r0 : r0 + r1]
string.dtype = float
string = string.view(float)
_write_data_string(
f, string, r0, r1, multiplier, perline, numform
)
Expand All @@ -1321,7 +1321,7 @@ def _write_ascii_sparse(
for r0, r1 in ind:
string = coldata[j : j + r1]
j += r1
string.dtype = float
string = string.view(float)
_write_data_string(f, string, r0, r1, multiplier, perline, numform)
f.write(f"{cols + 1:8}{1:8}{1:8}\n")
f.write(numform % 2**0.5)
Expand Down Expand Up @@ -1523,7 +1523,7 @@ def _write_col_data(f, v, c, s, elems, endian, colHeader, colTrailer):
e = pv[-1]
elems = (e - s + 1) * multiplier
v = np.asarray(v[s : e + 1]).ravel()
v.dtype = float
v = v.view(float)
_write_col_data(f, v, c, s, elems, endian, colHeader, colTrailer)
else:
# sparse matrix:
Expand All @@ -1537,7 +1537,7 @@ def _write_col_data(f, v, c, s, elems, endian, colHeader, colTrailer):
vec = np.zeros(elems, dt)
vec[rs[pv] - s] = vs[pv]
elems *= multiplier
vec.dtype = float
vec = vec.view(float)
_write_col_data(f, vec, c, s, elems, endian, colHeader, colTrailer)
reclen = 3 * 4 + 8
f.write(colHeader.pack(reclen, cols + 1, 1, 2))
Expand Down Expand Up @@ -1566,7 +1566,7 @@ def _write_binary_sparse(
reclen = _write_col_header(f, ind, c, multiplier, colHeader)
for r0, r1 in ind:
string = v[r0 : r0 + r1]
string.dtype = float
string = string.view(float)
_write_data_string(
f, string, r0, r1, multiplier, LrStruct, endian
)
Expand All @@ -1583,7 +1583,7 @@ def _write_binary_sparse(
for r0, r1 in ind:
string = coldata[j : j + r1]
j += r1
string.dtype = float
string = string.view(float)
_write_data_string(f, string, r0, r1, multiplier, LrStruct, endian)
f.write(colTrailer.pack(reclen))
reclen = 3 * 4 + 8
Expand Down
Loading