-
Notifications
You must be signed in to change notification settings - Fork 82
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
Filters zhaw #327
Filters zhaw #327
Conversation
Added smoothing function
Thank you Jan, Could you try to rebase your code and master in order to fix the conflicts? (it's basically because the Few preliminary comments:
|
Hi Xavier, I hope the rebasing I attempted fixed the conflicts. In commit f9e9fee, I renamed all functions to As far as I understand, there are some differences between the current Where do you suggest putting the sample trajectories? Maybe "/src/traffic/data/samples"? |
Hi @krumjan |
In the following zip, you find two parquet files. "trajs_good.parquet" which contains some trajectories of rather good quality (if anything they only contain a few spikes) and "trajs_bad.parquet" which contains rather noisy trajectories. ;) |
src/traffic/core/flight.py
Outdated
:param kernel_size: The size of the kernel to use for the rolling mean. | ||
""" | ||
for paracol, kernel_size in zip(paracols, kernel_sizes): | ||
data = self.data.reset_index(drop=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this line be outside the loop?
Also, why not name this one filter_mean? (the only difference with filter_median is the mean method, right?)
src/traffic/core/flight.py
Outdated
for paracol, th1, th2, window in zip(paracols, th1s, th2s, windows): | ||
diff1 = abs(data[paracol].diff()) | ||
if paracol == "track": | ||
diff1.loc[(diff1 < 370) & (diff1 > 350)] = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to work on track_unwrapped
?
Thank you Jan for the pull request I did some major changes in the way we do filtering, and would love to have you check that. Basically:
Once you have a look, I will start working on tests. It would be nice if you could also check the documentation of your classes and write what you like there. I copied and pasted things, but you may prefer to put things differently. (It appears in api_reference/traffic.algorithms.filters.html) I may keep illustrated examples from this PR for a specific user guide on filtering (https://traffic-viz.github.io/user_guide/processing.html) |
Added four functions for trajectory filtering/preprocessing (median_filter, deriv_filter, cluster_filter, smoothing), as well as a fifth function (filter_zhaw) which applies the other four functions with varying parameters adjusted to the different flight-parameters.
For trajectories of good quality, the current traffic filter() function and filter_zhaw() appear to produce similar results. For trajectories of poor quality, however, the new approach often seems to perform better. See below two examples for trajectories of rather poor quality (blue = unfiltered, green = traffic filter, orange = filter_zhaw)