univie-datamining-team3 / assignment2

Analysis of mobility data
MIT License
0 stars 0 forks source link

Preprocessing: Cut first and last 30 seconds of scripted trips #3

Closed Lumik7 closed 6 years ago

Lumik7 commented 6 years ago

Create a method in preprocessing.py that deals with the following issue: From task description: "Only for scripted trips: The first and last few seconds of each trip will be affected by the
smartphone handling when you start and stop the trip and put the phone into it’s
supposed position. That’s why you must discard the first and last 30 seconds of your
scripted trips and NOT consider these for further analysis."

rmitsch commented 6 years ago

@Lumik7 @MoBran Added in 8334501d61470a4075e6da16b3e10ad542e61bee. Forgot to switch back to my branch, so I pushed directly to master by accident - sorry. Code and code usage can be reviewed in Preprocessor.preprocess(). Relevant methods are _cut_off_start_and_end_in_dataframes(...) and _cut_off_start_and_end_in_dataframe(...).

Closing this issue If there are no objections.

Lumik7 commented 6 years ago

Hey just saw your implementation. I don't know if i wrote "scripted" lower case all the time. Could you cast the string to lower case just to make sure?

rmitsch commented 6 years ago

Done in 23dc71c0b8ef09689bf6a6296b1a37b21454acea. Should I merge with master?

Lumik7 commented 6 years ago

thanks, yes go ahead

Lumik7 commented 6 years ago

I found a bug with the cutting procedure, it seems that only the left side of a trip is cut. When running the preprocessing() function with a cutoff_in_seconds=180:

 # 3. Cut first and last 30 seconds from scripted trips.
dfs = Preprocessor.replace_none_values_with_empty_dataframes(
Preprocessor._cut_off_start_and_end_in_dataframes(
                    dataframes=dfs, list_of_dataframe_names_to_cut=["sensor", "location"], cutoff_in_seconds=180
                )
            )

3 minutes are cut from the beginning, but the right side stays the same, see picture:

bug_trip_length

The expected behaviour would be that 180 seconds are cut on both ends.

rmitsch commented 6 years ago

That's weird. I'll have a look at it tomorrow.

rmitsch commented 6 years ago

Fixed and merged into master, was a rather stupid mistake (+ instead of -). I'll close this issue. Should the error still occur, please reopen it.