API - pytracks.input Module¶
This module helps inputting raw text data into pytracks’s data wrappers. Please see the examples included to learn how to use it.
Note
All of the ids you specify reference indexes in an array, so they always start at 0.
TrackWrapper¶
-
class
pytracks.input.TrackWrapper(data_file, sectioned, id_column, x_column, y_column, g_column, m_column, worth_column, weight_column, extra_ids)¶ Parameters: - data_file (string) – Path to the datafile.
- sectioned (boolean) – If the file has multiple sets of data in it. Default is True.
- id_column (int) – The column index holding the id data. Default is 1.
- x_column (int) – The column index holding the x data. Default is 2.
- y_column (int) – The column index holding the y data. Default is 3.
- g_column (int) – The column index holding the growth data. Default is 4.
- m_column (int) – The column index holding the mortality data. Default is 5.
- worth_column (int) – The column index holding the worth data. Default is 6.
- weight_column (int) – The column index holding the weight data. Default is 7
- extra_ids (list of ints) – A list of indexes. The column indexes holding the the extra data desired. Default is None.
-
data¶ The list holding all the raw data read in from the file.
-
data_ids¶ The list holding the specified ids for the required columns.
-
extra_ids¶ The list holding the specified ids for the extra columns desired by the user.
-
classmethod
gen_trackset(index)¶ Parameters: index (int) – The desired dataset if the data file is sectioned. Default is 0. Returns: A generated pytracks.track.TrackSet.Generates a
pytracks.track.TrackSetobject from the raw data.
GridWrapper¶
-
class
pytracks.input.GridWrapper(data_file, sectioned, x_column, y_column, extra_ids)¶ Parameters: - data_file (string) – Path to the datafile.
- sectioned (boolean) – If the file has multiple sets of data in it. Default is True.
- x_column (int) – The column index holding the x data. Default is 1.
- y_column (int) – The column index holding the y data. Default is 2.
- extra_ids (list of ints) – A list of indexes. The column indexes holding the the extra data desired. Default is None.
-
data¶ The list holding all the raw data read in from the file.
-
data_ids¶ The list holding the specified ids for the required columns.
-
extra_ids¶ The list holding the specified ids for the extra columns desired by the user.
-
classmethod
gen_grid(index)¶ Parameters: index (int) – The desired dataset if the data file is sectioned. Default is 0. Returns: A generated pytracks.grid.Grid.Generates a
pytracks.grid.Gridobject from the raw data.
Extra Methods¶
-
pytracks.input.split_data(data, split_id)¶ Parameters: - data (list of lists) – 2D raw data.
- split_id (int) – The index on which to split the data.
A method to split the data according to an ID specified. Possibly useful to the user.
-
pytracks.input.get_data(data_file, sectioned)¶ Parameters: - data_file (string) – A path to a raw data file. Can be a relative or absolute path.
- sectioned (boolean) – If sectioned, split the data on the first column.
A method to read in raw data. Not useful to the user.