Oasys.THIS.Read class
Constants
- Read.CSV_COMMA
CSV comma separator
- Read.CSV_SPACE
CSV space separator
- Read.CSV_TAB
CSV tab separator
- Read.CSV_XYXY
CSV format X,Y,X,Y
- Read.CSV_XYYY
CSV format X,Y,Y,Y
- Read.DIADEM_COMMENT
Diadem comment written to curve tag
- Read.DIADEM_NAME
Diadem channel name written to curve tag
- Read.EQUATION_CURVE_VARS
Calculate x values from curve variables for equations
- Read.EQUATION_X_OR_CURVE
If there are no curve variables, use the X start, end and interval values for equation x values. Otherwise calculate x values from the curve variables
- Read.EQUATION_X_VALS
Use the X start, end and interval values for equation x values
- Read.ISO_CHANNEL_CODE
Use the channel code for the ISO curve labels
- Read.ISO_CHANNEL_LABEL
Use the channel label for the ISO curve labels
- Read.ISO_MULTIPLE_CHANNELS
Multiple channels ISO file
- Read.ISO_SINGLE_CHANNEL
Single channel ISO file
- Read.LSPP_CURVE_FILE
LSPP curve file format
- Read.LSPP_XY_PAIRS
LSPP XY pairs file format
Static methods
- classmethod Read.Bulk(filename, options=Oasys.gRPC.defaultArg)
Reads a Bulk Data file into T/HIS
- Parameters:
filename (String) – Name of Bulk Data file to read
options (dict) –
Optional. Options which give you greater control of reading a Bulk file:
- outputOpt (optional):
(integer/string) Allows you to control which curve ID number the file will begin to read at. This can either be a whole number greater than 0 or specified as a string like “#3” for curve 3. There are also the special string characters “%”, standing for highest free curve as well as “#”, standing for the lowest free curve. By default, this will be set to the highest free curve
- Returns:
No return value
- Return type:
None
Example
To read a Bulk Data file named “example.bdf”
Oasys.THIS.Read.Bulk("example.bdf")To read a Bulk Data file named “example.bdf” at the lowest free curve
options = {} options["outputOpt"] = "#" Oasys.THIS.Read.Bulk("example.bdf",options)
- classmethod Read.CSV(filename, options=Oasys.gRPC.defaultArg)
Reads a CSV file into T/HIS
- Parameters:
filename (String) – Name of CSV file to read
options (dict) –
Optional. Options which give you greater control of reading a CSV file:
- csvType (optional):
(integer) CSV file type. Can be
Read.CSV_XYXYorRead.CSV_XYYY- outputOpt (optional):
(integer/string) Allows you to control which curve ID number the file will begin to read at. This can either be a whole number greater than 0 or specified as a string like “#3” for curve 3. There are also the special string characters “%”, standing for highest free curve as well as “#”, standing for the lowest free curve. By default, this will be set to the highest free curve
- rowAxisLabel (optional):
(integer) Index of the row containing axis labels. This is row 2 by default, so should be set to 0 if no axis labels are present
- rowCurveLabel (optional):
(integer) Index of the row containing curve labels. This is row 1 by default, so should be set to 0 if no curve labels are present
- separator (optional):
(integer) Separator. Can be
Read.CSV_COMMA,Read.CSV_SPACEorRead.CSV_TAB- xColIndex (optional):
(integer) Index of the column containing X-values. This is column 1 by default
- xInterval (optional):
(float) User defined X-interval between points, to use together with xStartVal
- xStartVal (optional):
(float) Instead of taking X-values from the CSV file, this allows the user to define a value for the start of the X-axis
- Returns:
No return value
- Return type:
None
Example
To read an XYYY CSV file with X-values in column 3, named “example.csv” starting at curve 5
options = {} options["csvType"] = Oasys.THIS.Read.CSV_XYYY options["xColIndex"] = 3 options["outputOpt"] = "#5" Oasys.THIS.Read.CSV("example.csv", options)
- classmethod Read.Cur(filename, options=Oasys.gRPC.defaultArg)
Reads a Curve file into T/HIS
- Parameters:
filename (String) – Name of Curve file to read
options (dict) –
Optional. Options which give you greater control of reading a Curve file:
- outputOpt (optional):
(integer/string) Allows you to control which curve ID number the file will begin to read at. This can either be a whole number greater than 0 or specified as a string like “#3” for curve 3. There are also the special string characters “%”, standing for highest free curve as well as “#”, standing for the lowest free curve
- Returns:
No return value
- Return type:
None
Example
To read a Curve file named “example.cur”
Oasys.THIS.Read.Cur("example.cur")To read a Curve file named “example.cur” at the curve ID 15
options = {} options["outputOpt"] = 15 Oasys.THIS.Read.Cur("example.cur",options)
- classmethod Read.DIAdem(filename, x_axis_channel, options=Oasys.gRPC.defaultArg)
Reads a DIAdem file into T/HIS
- Parameters:
filename (String) – Name of DIAdem header file to read
x_axis_channel (integer) – Index of the channel to use as X-axis values. If this is 0 then the X-values can be generated from a start value and an interval in the following two arguments
options (dict) –
Optional. Options which give you greater control of reading the Diadem file:
- filter (optional):
(String) String to filter channel names/comments. Only channels whose names/comments contain the filter string will be read
- outputOpt (optional):
(integer/string) Allows you to control which curve ID number the file will begin to read at. This can either be a whole number greater than 0 or specified as a string like “#3” for curve 3. There are also the special string characters “%”, standing for highest free curve as well as “#”, standing for the lowest free curve. By default, this will be set to the highest free curve
- showChannelName (optional):
(float) Option to select what is written to the curve tag. Can be
Read.DIADEM_COMMENTorRead.DIADEM_NAME- xAxisInterval (optional):
(float) User defined interval between points on the X-axis, to use together with the previous argument
- xAxisStartVal (optional):
(float) Instead of taking X-values from a DIAdem channel, this allows the user to define a value for the start of the X-axis
- Returns:
No return value
- Return type:
None
Example
To read DIAdem channels from “EXAMPLE.DAT”, with channel comments filtered by “EXAMPLE” and X-values taken from channel 1, starting at curve 10 onwards sequentially:
options = {} options["filter"] = "EXAMPLE" options["outputOpt"] = 10 Oasys.THIS.Read.DIAdem("./files/DIAdem/EXAMPLE.DAT",1,options)
- classmethod Read.Equation(formula, options=Oasys.gRPC.defaultArg)
Create a curve from a user-defined equation
- Parameters:
formula (String) – Equation string
options (dict) –
Optional. Options which give you greater control of reading the Diadem file:
- curveID (optional):
(integer) Allows you to control which curve ID the file will begin to read into. By default, this will be set to the highest free curve by default if the option is not selected
- xEndVal (optional):
(float) Right endpoint of the x range. Default 1.0
- xInterval (optional):
(float) Interval between points. Default 0.01
- xStartVal (optional):
(float) Left endpoint of the x range. Default 0.0
- xValOpt (optional):
(integer) Option to select how x values are determined for the given equation.
Read.EQUATION_X_VALS, requires the xStartVal, xEndVal and xInterval options to also be set however these default to 0, 1 and 0.01 respectively.Read.EQUATION_CURVE_VARSwill calculate it’s x values from the curve variables that are used in the equation. This is the default if curve variables are used and no xValOpt has been provided.Read.EQUATION_X_OR_CURVEwill use Rea.EQUATION_X_VALS if there are no curve variables in the equation otherwise Read.EQUATION_CURVE_VARS if there are. -ID to take x values from Curve #ID (e.g. -5 for curve ID 5)- Returns:
No return value
- Return type:
None
Example
To plot the line y = x^2+2 for x in [-1,1] and an interval between points of 0.02 and set this curve as ID 3:
options = {} options["xStartVal"] = -1 options["xEndVal"] = 1 options["xInterval"] = 0.02 options["xValOpt"] = Oasys.THIS.Read.EQUATION_X_VALS options["curveID"] = 3 Oasys.THIS.Read.Equation("x^2+2",options)
- classmethod Read.ISO(filename, options=Oasys.gRPC.defaultArg)
Reads an ISO file into T/HIS
- Parameters:
filename (String) – Name of ISO file to read
options (dict) –
Optional. Options which give you greater control of reading an ISO file:
- fileFormat (optional):
(integer) Format of ISO file. Can be
Read.MULTIPLE_CHANNELS,Read.ISO_SINGLE_CHANNEL- labelType (optional):
(integer) Label type to use. Can be
Read.ISO_CHANNEL_LABEL,Read.ISO_CHANNEL_CODE- outputOpt (optional):
(integer/string) Allows you to control which curve ID the file will begin to read to. This can either be a whole number greater than 0 or specified as a string like “#3” for curve 3. There are also the special string characters “%”, standing for highest free curve as well as “#”, standing for the lowest free curve. By default, this will be set to the highest free curve
- Returns:
No return value
- Return type:
None
Example
To read a single channel ISO file named “example.001” to curve ID 7
options = {} options["fileFormat"] = Oasys.THIS.Read.ISO_SINGLE_CHANNEL options["outputOpt"] = 7 Oasys.THIS.Read.ISO("example.001", options)
- classmethod Read.Key(filename, options=Oasys.gRPC.defaultArg)
Reads a Keyword file into T/HIS
- Parameters:
filename (String) – Name of Keyword file to read
options (dict) –
Optional. Options which give you greater control of reading a Keyword file:
- outputOpt (optional):
(integer/string) Allows you to control which curve ID number the file will begin to read at. This can either be a whole number greater than 0 or specified as a string like “#3” for curve 3. There are also the special string characters “%”, standing for highest free curve as well as “#”, standing for the lowest free curve
- Returns:
No return value
- Return type:
None
Example
To read a Keyword file named “example.key”
Oasys.THIS.Read.Key("example.key")To read a Keyword file named “example.key” starting at curve 5 and sequentially incrementing if the file contains multiple curves
options = {} options["outputOpt"] = 5 Oasys.THIS.Read.Key("example.key",options)
- classmethod Read.LSPP(filename, options=Oasys.gRPC.defaultArg)
Reads an LS-PREPOST file into T/HIS
- Parameters:
filename (String) – Name of LS-PREPOST file to read
options (dict) –
Optional. Options which give you greater control of reading a Keyword file:
- fileFormat (optional):
(integer) LSPP file format. Can be
Read.LSPP_CURVE_FILEorRead.LSPP_XY_PAIRS- outputOpt (optional):
(integer/string) Allows you to control which curve ID number the file will begin to read at. This can either be a whole number greater than 0 or specified as a string like “#3” for curve 3. There are also the special string characters “%”, standing for highest free curve as well as “#”, standing for the lowest free curve. By default, this will be set to the highest free curve
- Returns:
No return value
- Return type:
None
Example
To read an LS-PREPOST XY pairs file named “example.xy”
options = {} options["fileFormat"] = Oasys.THIS.Read.LSPP_XY_PAIRS Oasys.THIS.Read.LSPP("example.xy", options)