read_two_column_stuff#

PySeismoSoil.helper_generic.read_two_column_stuff(data: str | numpy.ndarray, delta: float | None = None, sep: str = '\t', **kwargs_to_genfromtxt: dict[Any, Any]) tuple[numpy.ndarray, float][source]#

Process “data” into a two-columned “data_”.

Parameters:
  • data (str | np.ndarray) –

    If str: the full file name on the hard drive containing the data. If np.ndarray: the numpy array containing the data.

    The data can have one column (which contains the motion/spectrum) or two columns (1st column: time/freq; 2nd column: motion/spectrum). If only one column is supplied, another input parameter “d_” must also be supplied.

  • delta (float | None) – The time or frequency interval. If data is a file name, this parameter is ignored.

  • sep (str) – The file delimiter. If data is not a file name, this parameter is ignored.

  • **kwargs_to_genfromtxt (dict[Any, Any]) – Any extra keyword arguments will be passed to numpy.genfromtxt() function for loading the data from the hard drive.

Returns:

  • data_ (np.ndarray) – A two column numpy array containing the “delta array” (such as the time array or the frequency array) and the data.

  • delta (float) – The “delta value”, such as dt or df.

Raises:
  • TypeError – When data is not a file name or a numpy array

  • ValueError – When ‘delta’ such as dt or df is not provided for one-column data