sensortoolkit.testing_attrib_objs._airsensor.AirSensor
- class AirSensor(make, model)[source]
Bases:
object
Object for storing and accessing air sensor data and device attributes.
- Parameters
make (str) – The name of the air sensor manufacturer.
model (str) – The name of the air sensor model.
Methods
Prompts the user to select files or folders where recorded sensor datasets are located and copies files to the
../data/sensor_data/[sensor_name]/raw_data
data subdirectory.Construct parameter-specific subdirectories in the project path.
Import sensor datasets and load to the
AirSensor.data
attribute.Interactive method for configuring sensor data ingestion.
Attributes
default_proj_path
project_path
setup_data
- copy_datasets(select='directory')[source]
Prompts the user to select files or folders where recorded sensor datasets are located and copies files to the
../data/sensor_data/[sensor_name]/raw_data
data subdirectory.- Parameters
select (str, optional) – The selection scheme for indicating items in the location for sensor datasets within the file explorer menu. Options include
directory
(the user selects a directory and data files within the directory are copied),recursive directory
(the user specifies a parent directory and all files within folders nested in the parent directory are copied over), orfiles
(the user selects the files that they intend to copy over. Defaults todirectory
.- Returns
None.
- create_directories(param_headers=None)[source]
Construct parameter-specific subdirectories in the project path.
Subdirectories are constructed within the
/figures/[sensor_name]
path for SDFS parameters measured by the air sensor. Calls thesensortoolkit.lib_utils.create_sensor_subdirectories()
method.- Parameters
param_headers (list, optional) – A list of SDFS parameters measured by the air sensor. Defaults to None.
- Returns
None.
- load_data(load_raw_data, write_to_file, **kwargs)[source]
Import sensor datasets and load to the
AirSensor.data
attribute.- Parameters
load_raw_data (bool) – If true, processed (SDFS formatted) sensor datasets will be saved as csv files to the
/data/sensor_data/[sensor_name]/processed_data
directory. If false, formatted datasets will not be saved to the user’s hard drive.write_to_file (bool) – If true, raw data (datasets as originally recorded) in the appropriate subdirectory will be loaded and 1-hour and 24-hour averages will be computed. If false, processed data will be loaded.
**kwargs (dict) –
- Returns
None.
- sensor_setup()[source]
Interactive method for configuring sensor data ingestion.
Selecting File Data Type:
Choose the corresponding data file type for recorded sensor datasets from
'.csv'
,'.txt'
,'.xlsx'
.Selecting Data Files:
Choose the selection scheme for pointing to recorded data files from the following options:
'directory'
, which will locate and copy all of the data files in the specified directory for the indicated data type'recursive directory'
, which will locate and copy all data files within the specified directory and any subdirectories contained within the indicated folder path'files'
which copies over files that the user manually selects within a directory.
Copying Data Files:
Recorded sensor datasets are copied from the selected file or folder location to the
../data/sensor_data/[sensor_name]/raw_data
directory path.Selecting the Column Header Index:
Users indicate the integer index position for the row of header data in sensor datasets.
Parsing Sensor Datasets:
The first few rows of recorded sensor datasets located in the
../data/sensor_data/[sensor_name]/raw_data
directory path are imported and the names of column headers are located based on the indicated head index. A list of unique column headers is stored for subsequent reassignment of column header names.Specifying Timestamp Columns:
Users indicate the column(s) containing date/timestamp information.
Specifying the Parameter Renaming Scheme:
Users indicate the SDFS parameters corresponding to column names discovered in step 5. This creates a parameter renaming dictionary for reassigning the names of header labels.
Configuring Timestamp Column Formatting:
Users indicate the date/time formatting for date/time column(s) indicated in step 6. Formatting should correspond to the
strftime
formatting keywords located at https://strftime.org/Specifying the DateTime Index Time Zone:
Users indicate the time zone associated with the date/time column(s). Timezones should be valid timezone names recognized by the
pytz
library.Configuring Sensor Serial Identifiers:
Users should select unique serial identifiers corresponding to each sensor unit in the testing group. Identifying keywords for each sensor unit should be indicated within the recorded sensor dataset file names.
Saving the Setup Configuration to
setup.json
:The setup configuration specified by the user is saved to a
setup.json
file for subsequent use by the ingestion module for importing recorded sensor datasets and conversion to SDFS datasets.
- Returns
None.