| 27 | return strands_data |
| 28 | |
| 29 | def normalize_data_2D(strands_data, mean, std): |
| 30 | # print("strands_data ",strands_data.shape) |
| 31 | orig_shape = strands_data.shape |
| 32 | nr_strands = strands_data.shape[0] |
| 33 | strands_data=strands_data.view(nr_strands, -1) |
| 34 | # print("strands_data ",strands_data.shape) |
| 35 | # print("mean ",mean.shape) |
| 36 | strands_data=strands_data-mean.view(1,-1) |
| 37 | |
| 38 | strands_data=strands_data/(std.view(1,-1)+1e-6) |
| 39 | |
| 40 | #checks which elements are zero in the std and just set them to zero because they are basically noise |
| 41 | valid=std.view(1,-1)>=1e-9 |
| 42 | strands_data=strands_data*valid |
| 43 | |
| 44 | strands_data=strands_data.view(orig_shape) |
| 45 | return strands_data |
| 46 | |
| 47 | def un_normalize_data(strands_data, mean, std): |
| 48 | orig_shape = strands_data.shape |