-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug of simulating GPS data #267
Comments
Hi @JiaxinCCC, I'll let @GeorgeEfstathiadis address the error but I've noticed that you may have exposed your API key for OpenRouteService above. If so, you should invalidate that key and generate a new one. |
Thank you for catching that! I’ll revoke the API key and generate a new one to secure access. I appreciate the heads-up. I’ll also follow up with George about the error. |
Hi @JiaxinCCC , so I ran the code myself as is in the code segmented you provided and was not able to replicate your error. Did you perhaps modify the This error is raised when the |
@GeorgeEfstathiadis thanks for your reply! My Python version is # Currently, all imports from `forest` must be explicit. For the below example you need to import the following
# In future, it would be great to have all functions import automatically
import datetime
from forest.bonsai.simulate_gps_data import gps_to_csv, sim_gps_data
from forest.bonsai.simulate_log_data import sim_log_data
from forest.jasmine.traj2stats import Frequency, gps_stats_main
from forest.willow.log_stats import log_stats_main
# 1. If you don't have any smartphone data (yet) you can generate fake data
path_to_synthetic_gps_data = "simu_gps_data"
path_to_synthetic_log_data = "simu_log_data"
path_to_gps_summary = "simu_gps_output"
path_to_log_summary = "simu_log_output"
# Generate fake call and text logs
# Because of the explicit imports, you don't have to precede the functions with forest.subpackage.
sim_log_data(path_to_synthetic_log_data)
# Generate synthetic gps data and communication logs data as csv files
# Define parameters for generating the data
# To save smartphone battery power, we typically collect location data intermittently: e.g. during an on-cycle of 3 minutes, followed by an off-cycle of 12 minutes. We'll generate data in this way
# number of persons to generate
n_persons = 1
# location of person to generate format: Country_2_letter_ISO_code/City_Name
location = "GB/Bristol"
# start date of generated trajectories
start_date = datetime.date(2021, 10, 1)
# end date of trajectories
end_date = datetime.date(2021, 10, 5)
# api key for openroute service, generated from https://openrouteservice.org/
api_key = "mock_api_key"
# Length of off-cycle + length of on-cycle in minutes
cycle = 15
# Length off-cycle / (length off-cycle + length on-cycle)
percentage = 0.8
# dictionary of personal attributes for each user, set to None if random, check Attributes class for usage in simulate_gps_data module.
personal_attributes = {
"User 1":
{
"main_employment": "none",
"vehicle" : "car",
"travelling_status": 10,
"active_status": 7
},
"Users 2-4":
{
"main_employment": "university",
"vehicle" : "bicycle",
"travelling_status": 8,
"active_status": 8,
"active_status-16": 2
},
"User 5":
{
"main_employment": "office",
"vehicle" : "foot",
"travelling_status": 9,
"travelling_status-20": 1,
"preferred_exits": ["cafe", "bar", "cinema"]
}
}
sample_gps_data = sim_gps_data(n_persons, location, start_date, end_date, cycle, percentage, api_key, personal_attributes)
# save data in format of csv files
gps_to_csv(sample_gps_data, path_to_synthetic_gps_data, start_date, end_date) Let me know if more information is needed. |
Hi @GeorgeEfstathiadis @hackdna,
I followed the code below to simulate GPS data.
However, I encountered the following error, which seems like a bug in the code.
Do you have any suggestions on how I might resolve this error? Thanks for your help!
The text was updated successfully, but these errors were encountered: