Sadjad Alikhani
commited on
Upload input_preprocess.py
Browse files- input_preprocess.py +2 -6
input_preprocess.py
CHANGED
|
@@ -49,10 +49,6 @@ def tokenizer(selected_scenario_names=None, manual_data=None, gen_raw=True):
|
|
| 49 |
|
| 50 |
cleaned_deepmimo_data = [deepmimo_data_cleaning(deepmimo_data[scenario_idx]) for scenario_idx in range(n_scenarios)]
|
| 51 |
|
| 52 |
-
print(len(cleaned_deepmimo_data))
|
| 53 |
-
print(len(cleaned_deepmimo_data[0]))
|
| 54 |
-
print(len(cleaned_deepmimo_data[0][0]))
|
| 55 |
-
|
| 56 |
patches = [patch_maker(cleaned_deepmimo_data[scenario_idx]) for scenario_idx in range(n_scenarios)]
|
| 57 |
patches = np.vstack(patches)
|
| 58 |
|
|
@@ -77,7 +73,7 @@ def tokenizer(selected_scenario_names=None, manual_data=None, gen_raw=True):
|
|
| 77 |
def deepmimo_data_cleaning(deepmimo_data):
|
| 78 |
idxs = np.where(deepmimo_data['user']['LoS'] != -1)[0]
|
| 79 |
cleaned_deepmimo_data = deepmimo_data['user']['channel'][idxs]
|
| 80 |
-
return cleaned_deepmimo_data
|
| 81 |
|
| 82 |
#%% Patch Creation
|
| 83 |
def patch_maker(original_ch, patch_size=16, norm_factor=1e6):
|
|
@@ -98,7 +94,7 @@ def patch_maker(original_ch, patch_size=16, norm_factor=1e6):
|
|
| 98 |
# # Reshaping and normalizing channels
|
| 99 |
# original_ch = data['user']['channel'][idxs]
|
| 100 |
flat_channels = original_ch.reshape((original_ch.shape[0], -1)).astype(np.csingle)
|
| 101 |
-
flat_channels_complex = np.hstack((flat_channels.real, flat_channels.imag))
|
| 102 |
|
| 103 |
# Create patches
|
| 104 |
n_patches = flat_channels_complex.shape[1] // patch_size
|
|
|
|
| 49 |
|
| 50 |
cleaned_deepmimo_data = [deepmimo_data_cleaning(deepmimo_data[scenario_idx]) for scenario_idx in range(n_scenarios)]
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
patches = [patch_maker(cleaned_deepmimo_data[scenario_idx]) for scenario_idx in range(n_scenarios)]
|
| 53 |
patches = np.vstack(patches)
|
| 54 |
|
|
|
|
| 73 |
def deepmimo_data_cleaning(deepmimo_data):
|
| 74 |
idxs = np.where(deepmimo_data['user']['LoS'] != -1)[0]
|
| 75 |
cleaned_deepmimo_data = deepmimo_data['user']['channel'][idxs]
|
| 76 |
+
return np.array(cleaned_deepmimo_data) * 1e6
|
| 77 |
|
| 78 |
#%% Patch Creation
|
| 79 |
def patch_maker(original_ch, patch_size=16, norm_factor=1e6):
|
|
|
|
| 94 |
# # Reshaping and normalizing channels
|
| 95 |
# original_ch = data['user']['channel'][idxs]
|
| 96 |
flat_channels = original_ch.reshape((original_ch.shape[0], -1)).astype(np.csingle)
|
| 97 |
+
flat_channels_complex = np.hstack((flat_channels.real, flat_channels.imag))
|
| 98 |
|
| 99 |
# Create patches
|
| 100 |
n_patches = flat_channels_complex.shape[1] // patch_size
|