diff --git a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map.pickle b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map.pickle index 2776c5c..617a2fe 100644 Binary files a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map.pickle and b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map.pickle differ diff --git a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_0.pickle b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_0.pickle new file mode 100644 index 0000000..33e91b2 Binary files /dev/null and b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_0.pickle differ diff --git a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_1.pickle b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_1.pickle new file mode 100644 index 0000000..298009a Binary files /dev/null and b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_1.pickle differ diff --git a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_2.pickle b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_2.pickle new file mode 100644 index 0000000..0a5fe0b Binary files /dev/null and b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_2.pickle differ diff --git a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_3.pickle b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_3.pickle new file mode 100644 index 0000000..225bb83 Binary files /dev/null and b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_3.pickle differ diff --git a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_4.pickle b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_4.pickle new file mode 100644 index 0000000..4b15318 Binary files /dev/null and b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_4.pickle differ diff --git a/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_5.pickle b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_5.pickle new file mode 100644 index 0000000..5bcc665 Binary files /dev/null and b/example/20190505_170223_sig/1c36bb06203c_pkttype_8_map_5.pickle differ diff --git a/example/20190505_170223_sig/98ded0624482_pkttype_8_map.pickle b/example/20190505_170223_sig/98ded0624482_pkttype_8_map.pickle index 0ae0a70..53faf02 100644 Binary files a/example/20190505_170223_sig/98ded0624482_pkttype_8_map.pickle and b/example/20190505_170223_sig/98ded0624482_pkttype_8_map.pickle differ diff --git a/example/20190505_170223_sig/98ded0624482_pkttype_8_map_0.pickle b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_0.pickle new file mode 100644 index 0000000..62fec87 Binary files /dev/null and b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_0.pickle differ diff --git a/example/20190505_170223_sig/98ded0624482_pkttype_8_map_1.pickle b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_1.pickle new file mode 100644 index 0000000..c4f9097 Binary files /dev/null and b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_1.pickle differ diff --git a/example/20190505_170223_sig/98ded0624482_pkttype_8_map_2.pickle b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_2.pickle new file mode 100644 index 0000000..d859915 Binary files /dev/null and b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_2.pickle differ diff --git a/example/20190505_170223_sig/98ded0624482_pkttype_8_map_3.pickle b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_3.pickle new file mode 100644 index 0000000..0fe177f Binary files /dev/null and b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_3.pickle differ diff --git a/example/20190505_170223_sig/98ded0624482_pkttype_8_map_4.pickle b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_4.pickle new file mode 100644 index 0000000..4cfaabc Binary files /dev/null and b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_4.pickle differ diff --git a/example/20190505_170223_sig/98ded0624482_pkttype_8_map_5.pickle b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_5.pickle new file mode 100644 index 0000000..a81a795 Binary files /dev/null and b/example/20190505_170223_sig/98ded0624482_pkttype_8_map_5.pickle differ diff --git a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map.pickle b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map.pickle index bc0220a..eaf55cc 100644 Binary files a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map.pickle and b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map.pickle differ diff --git a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_0.pickle b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_0.pickle new file mode 100644 index 0000000..db370d9 Binary files /dev/null and b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_0.pickle differ diff --git a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_1.pickle b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_1.pickle new file mode 100644 index 0000000..e7b2cfb Binary files /dev/null and b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_1.pickle differ diff --git a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_2.pickle b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_2.pickle new file mode 100644 index 0000000..77530da Binary files /dev/null and b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_2.pickle differ diff --git a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_3.pickle b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_3.pickle new file mode 100644 index 0000000..fcb7e98 Binary files /dev/null and b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_3.pickle differ diff --git a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_4.pickle b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_4.pickle new file mode 100644 index 0000000..c4ad98a Binary files /dev/null and b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_4.pickle differ diff --git a/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_5.pickle b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_5.pickle new file mode 100644 index 0000000..80517fe Binary files /dev/null and b/example/20190505_170223_sig/98ded07d4483_pkttype_8_map_5.pickle differ diff --git a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map.pickle b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map.pickle index a653512..e2f67e5 100644 Binary files a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map.pickle and b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map.pickle differ diff --git a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_0.pickle b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_0.pickle new file mode 100644 index 0000000..d430cd5 Binary files /dev/null and b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_0.pickle differ diff --git a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_1.pickle b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_1.pickle new file mode 100644 index 0000000..e5ae559 Binary files /dev/null and b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_1.pickle differ diff --git a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_2.pickle b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_2.pickle new file mode 100644 index 0000000..7610245 Binary files /dev/null and b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_2.pickle differ diff --git a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_3.pickle b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_3.pickle new file mode 100644 index 0000000..8d0127b Binary files /dev/null and b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_3.pickle differ diff --git a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_4.pickle b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_4.pickle new file mode 100644 index 0000000..dd5d81e Binary files /dev/null and b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_4.pickle differ diff --git a/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_5.pickle b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_5.pickle new file mode 100644 index 0000000..2366712 Binary files /dev/null and b/example/20190505_170223_sig/98fc11691fc5_pkttype_8_map_5.pickle differ diff --git a/libs/parser_post.py b/libs/parser_post.py index 768c1e6..c47694b 100644 --- a/libs/parser_post.py +++ b/libs/parser_post.py @@ -63,12 +63,10 @@ def blocking_display_rss_map(rss_map: np.ndarray): ''' ''' plt.imshow( - np.transpose(rss_map) - np.nanmedian(rss_map), + np.transpose(rss_map), cmap='hot', origin='lower', - interpolation='nearest', - vmin=-15, - vmax=15 + interpolation='nearest' ) plt.colorbar() # plt.show() @@ -81,7 +79,7 @@ def blocking_display_rss_map(rss_map: np.ndarray): print() -def convert_to_pickle_rss(fp: str, orientation: int, visualize: bool): +def convert_to_pickle_rss(fp: str, orientation: int, visualize: bool = False, filters: int = None): ''' modified from Zhuolin ''' @@ -137,17 +135,32 @@ def convert_to_pickle_rss(fp: str, orientation: int, visualize: bool): upper_bound_y + factor * PICKLE_MAP_STEP ) data_fullfilled = data_part[2, data_y_idxs] - # orientation_fullfilled = data_part[3, data_y_idxs] - # data_fullfilled[(orientation_fullfilled > 0.5 * np.pi) & (orientation_fullfilled < 1.5 * np.pi)] = data_fullfilled[(orientation_fullfilled > 0.5 * np.pi) & (orientation_fullfilled < 1.5 * np.pi)] + 10.0 - # data_fullfilled[(orientation_fullfilled > 0.1 * np.pi) & (orientation_fullfilled < 0.5 * np.pi)] = data_fullfilled[(orientation_fullfilled > 0.1 * np.pi) & (orientation_fullfilled < 0.5 * np.pi)] + 5.0 - # data_fullfilled[(orientation_fullfilled > 1.5 * np.pi) & (orientation_fullfilled < 1.9 * np.pi)] = data_fullfilled[(orientation_fullfilled > 1.5 * np.pi) & (orientation_fullfilled < 1.9 * np.pi)] + 5.0 + orientation_fullfilled = data_part[3, data_y_idxs] + if filters is 0: + data_fullfilled = data_fullfilled[(orientation_fullfilled > 1.75 * np.pi) | (orientation_fullfilled < 0.25 * np.pi)] + elif filters is 1: + data_fullfilled = data_fullfilled[(orientation_fullfilled > 1.25 * np.pi) & (orientation_fullfilled < 1.75 * np.pi)] + elif filters is 2: + data_fullfilled = data_fullfilled[(orientation_fullfilled > 0.75 * np.pi) & (orientation_fullfilled < 1.25 * np.pi)] + elif filters is 3: + data_fullfilled = data_fullfilled[(orientation_fullfilled > 0.25 * np.pi) & (orientation_fullfilled < 0.75 * np.pi)] + elif filters is 4: + data_fullfilled = data_fullfilled[(orientation_fullfilled > 1.5 * np.pi) | (orientation_fullfilled < 0.5 * np.pi)] + elif filters is 5: + data_fullfilled = data_fullfilled[(orientation_fullfilled > 0.5 * np.pi) & (orientation_fullfilled < 1.5 * np.pi)] if data_fullfilled.size: rss_map[i, j] = max(np.median(data_fullfilled), -85.0) if visualize: blocking_display_rss_map(rss_map) - with open(fp.replace(".csv", "_pkttype_{}_map.pickle".format(pkt_types[0][0])), "wb") as f: + with open( + fp.replace( + ".csv", "_pkttype_{}_map{}.pickle" + .format(pkt_types[0][0], "" if filters is None else "_{}".format(filters)) + ), + "wb" + ) as f: pickle.dump(rss_map, f) diff --git a/preprocessor.py b/preprocessor.py index 64144e0..b309d03 100644 --- a/preprocessor.py +++ b/preprocessor.py @@ -74,7 +74,13 @@ def convert_to_pickle(filepaths, orientation, visualize, is_csi): for filepath in filepaths: print("parsing file: {}".format(filepath)) try: - convert_to_pickle_rss(filepath, orientation, visualize) + convert_to_pickle_rss(filepath, orientation, visualize=visualize, filters=None) + convert_to_pickle_rss(filepath, orientation, visualize=visualize, filters=0) + convert_to_pickle_rss(filepath, orientation, visualize=visualize, filters=1) + convert_to_pickle_rss(filepath, orientation, visualize=visualize, filters=2) + convert_to_pickle_rss(filepath, orientation, visualize=visualize, filters=3) + convert_to_pickle_rss(filepath, orientation, visualize=visualize, filters=4) + convert_to_pickle_rss(filepath, orientation, visualize=visualize, filters=5) except KeyboardInterrupt: print("KeyboardInterrupt happened") @@ -94,6 +100,7 @@ def main(args): f_sig_extracted = extract_dev_from_combined(f_sig_combined, minimalCounts=5000) if args.pickle: + # f_sig_extracted = [x for x in f_sig_extracted if '98fc11691fc5' in x] convert_to_pickle(f_sig_extracted, args.orientation, args.visualize, is_csi) # generate path in map for visualization