Basics: loading CDMs#
Load CDMs from .kvn#
In this tutorial, we show how to load CDMs from .kvn
format.
First, the CDMs in .kvn
format need to be placed inside the path_to_cdms_folder
, for correctly loading the data. Furthermore, the code expects the CDMs in the folder to have file names grouped by: individual event and the CDM sequence in each event.
For instance, if we have to load two events with 3 and 2 CDMs each, we might then have file names in the following format:
event_1_01.cdm.kvn.txt
event_1_02.cdm.kvn.txt
event_1_03.cdm.kvn.txt
event_2_01.cdm.kvn.txt
event_2_02.cdm.kvn.txt
from kessler import EventDataset
We can then proceed in creating the EventDataset
object:
path_to_cdms_folder='synthetic_cdms/'
events=EventDataset(path_to_cdms_folder,cdm_extension='.kvn')
#A message appears confirming that the loading has happened, with the number of CDMs and events.
Loading CDMS (with extension .kvn) from directory: synthetic_cdms/
Loaded 14 CDMs grouped into 2 events
Loading CDMs from Kelvins Challenge dataset#
In this tutorial, we show the case in which the data to be loaded comes from the Kelvins competition: a collision avoidance challenge organized by ESA in 2019.
For this purpose, we built a specific converter that takes care of the conversion from the Kelvins format to standard CDM format. First, we perform the relevant imports:
from kessler.data import kelvins_to_event_dataset
Then, we proceed in converting the Kelvins dataset as an EventDataset
objetc. In the following example, we leverage two extra entries (i.e., drop_features
and num_events
) to exclude certain features when importing, and to only import a limited number of events (in this case 1000).
file_name='kelvins_data/test_data.csv'
events=kelvins_to_event_dataset(file_name, drop_features=['c_rcs_estimate', 't_rcs_estimate'], num_events=1000)
#The output will show the number of CDMs and events loaded, as they progress.
Loading Kelvins dataset from file name: /Users/giacomoacciarini/cdm_data/kelvins_data/test_data.csv
24484 entries
Dropping features: ['c_rcs_estimate', 't_rcs_estimate']
Dropping rows with NaNs
21932 entries
Removing outliers
19531 entries
Shuffling
Grouped rows into 1726 events
Taking TCA as current time: 2022-02-17 23:50:10.189235
Converting Kelvins challenge data to EventDataset
Time spent | Time remain.| Progress | Events | Events/sec
0d:00:00:07 | 0d:00:00:00 | #################### | 1000/1000 | 128.69