pyyeti.nastran.bulk.wttabled1¶
- pyyeti.nastran.bulk.wttabled1(f, tid, t, d, title=None, form='{:16.9E}{:16.9E}', tablestr='TABLED1')[source]¶
Writes a Nastran TABLED1 (or similar) card to a file.
- Parameters:
f (string or file_like or 1 or None) – Either a name of a file, or is a file_like object as returned by
open()orio.StringIO. Input as integer 1 to write to stdout. Can also be the name of a directory or None; in these cases, a GUI is opened for file selection.tid (integer) – ID for TABLED1 card
t (1d array_like) – time vector
d (1d array_like) – data vector
title (string or None; optional) – If a string, it is written as a comment before table. If None, no string is written.
form (string; optional) – String specifying the format of a single [time, data] pair. Expected to result in a string either 16 or 32 characters long.
tablestr (string; optional) – Name of card to write; must be same format as TABLED1.
- Returns:
None
Notes
In the format string, include a # sign to force a decimal point to appear without trailing digits. For example, ‘{:8.2f}{:#8.0f}’ would print like this: ‘ 12.34 123456.’.
See also
Examples
>>> from pyyeti import nastran >>> import numpy as np >>> t = np.arange(0, .91, .05) >>> d = np.sin(2*np.pi*3*t) >>> nastran.wttabled1(1, 4000, t, d, '3 Hz Sine Wave', ... form='{:8.2f}{:8.5f}') $ 3 Hz Sine Wave TABLED1 4000 0.00 0.00000 0.05 0.80902 0.10 0.95106 0.15 0.30902 0.20-0.58779 0.25-1.00000 0.30-0.58779 0.35 0.30902 0.40 0.95106 0.45 0.80902 0.50 0.00000 0.55-0.80902 0.60-0.95106 0.65-0.30902 0.70 0.58779 0.75 1.00000 0.80 0.58779 0.85-0.30902 0.90-0.95106ENDT >>> nastran.wttabled1(1, 4000, [1, 2, 3], [1, 2, 3], ... form='{:16.2f}{:16.5f}') TABLED1* 4000 * * 1.00 1.00000 2.00 2.00000 * 3.00 3.00000ENDT