cmtklib.carbonfootprint module
Module that defines CMTK functions for converting C02 emissions estimated with codecarbon
.
- cmtklib.carbonfootprint.create_carbon_footprint_message(bids_dir, emissions_csv_file, nb_of_subjects_processed)[source]
Return a string containg the carbon footprint print message to be passed to
print()
.- Parameters
bids_dir (string) – Path to root directory of the BIDS dataset
emissions_csv_file (string) – Path to the
emissions.csv
file generated byCodecarbon
.nb_of_subjects_processed (int) – Number of subject processed.
- Returns
carbon_footprint_msg – String formatted containing the carbon footprint meassge to be passed to
print()
- Return type
string
- cmtklib.carbonfootprint.create_emissions_tracker(bids_root)[source]
Return a new instance of
codecarbon.EmissionsTracker
.- Parameters
bids_root (string) – Path to the root directory of the BIDS dataset
- Returns
tracker – Return a new instance of
codecarbon.EmissionsTracker
- Return type
codecarbon.EmissionsTracker
References
https://github.com/mlco2/codecarbon/blob/v1.2.0/codecarbon/emissions_tracker.py
- cmtklib.carbonfootprint.create_html_carbon_footprint_report(emissions_csv_file, nb_of_subjects_processed)[source]
Return a string containing the content of html report to be passed to traits
Str
withHTMLEditor
.- Parameters
emissions_csv_file (string) – Path to the
emissions.csv
file generated byCodecarbon
.nb_of_subjects_processed (int) – Number of subject processed.
- cmtklib.carbonfootprint.get_emission_car_miles_equivalent(emissions)[source]
Return the equivalent of CO2 emissions [Kg] in terms of kms traveled by an average car.
References
- cmtklib.carbonfootprint.get_emission_tv_time_equivalent(emissions)[source]
Return the equivalent of CO2 emissions [Kg] in terms of kms traveled by an average car.
References
- cmtklib.carbonfootprint.load_and_compute_carbon_footprint_metrics(emissions_csv_file, nb_of_subjects_processed) dict [source]
Return a dictionary storing the different metrics and variables displayed in the carbon footprint report.
The dictionary has the different fields:
'country_name'
,'region_name'
,'country_emissions_per_kwh'
,'duration'
,'energy_consumed'
,'emissions'
,'car_kms'
,'tv_time'
,'pred_energy_consumed'
,'pred_emissions'
,'pred_car_kms'
,'pred_tv_time'
.- Parameters
emissions_csv_file (string) – Path to the
emissions.csv
file generated byCodecarbon
.nb_of_subjects_processed (int) – Number of subject processed.