|
10 | 10 | }, |
11 | 11 | { |
12 | 12 | "cell_type": "code", |
13 | | - "execution_count": null, |
| 13 | + "execution_count": 1, |
14 | 14 | "id": "3232df80-2a65-47ce-bc77-6a64f44d2404", |
15 | 15 | "metadata": {}, |
16 | 16 | "outputs": [], |
|
36 | 36 | "from epare.config import all_configs, Config, MultIdent, CountermeasureIdent\n", |
37 | 37 | "from epare.prob_map import ProbMap\n", |
38 | 38 | "from epare.error_model import ErrorModel\n", |
| 39 | + "from epare.filters import *\n", |
39 | 40 | "\n", |
40 | 41 | "if sys.version_info >= (3, 14):\n", |
41 | 42 | " from compression import zstd\n", |
|
56 | 57 | }, |
57 | 58 | { |
58 | 59 | "cell_type": "code", |
59 | | - "execution_count": null, |
| 60 | + "execution_count": 2, |
60 | 61 | "id": "e89e66dc-4a9b-4320-8612-a8fa9af04b69", |
61 | 62 | "metadata": {}, |
62 | 63 | "outputs": [], |
|
79 | 80 | }, |
80 | 81 | { |
81 | 82 | "cell_type": "code", |
82 | | - "execution_count": null, |
| 83 | + "execution_count": 3, |
83 | 84 | "id": "bab2a086-8b3d-4e76-bf5c-46ea2b617708", |
84 | 85 | "metadata": {}, |
85 | | - "outputs": [], |
| 86 | + "outputs": [ |
| 87 | + { |
| 88 | + "name": "stdout", |
| 89 | + "output_type": "stream", |
| 90 | + "text": [ |
| 91 | + "small_primes [3, 5, 7] ... [199]\n", |
| 92 | + "medium_primes [211, 223, 227] ... [397]\n", |
| 93 | + "large_primes [401, 409, 419] ... [997]\n", |
| 94 | + "all_primes [3, 5, 7] ... [997]\n", |
| 95 | + "all_integers [1, 2, 3] ... [399]\n", |
| 96 | + "all_even [2, 4, 6] ... [398]\n", |
| 97 | + "all_odd [1, 3, 5] ... [399]\n", |
| 98 | + "powers_of_2 [2, 4, 8] ... [524288]\n", |
| 99 | + "powers_of_2_large [2, 4, 8] ... [57896044618658097711785492504343953926634992332820282019728792003956564819968]\n", |
| 100 | + "powers_of_2_large_3 [6, 12, 24] ... [173688133855974293135356477513031861779904976998460846059186376011869694459904]\n", |
| 101 | + "powers_of_2_large_p1 [3, 5, 9] ... [57896044618658097711785492504343953926634992332820282019728792003956564819969]\n", |
| 102 | + "powers_of_2_large_m1 [1, 3, 7] ... [57896044618658097711785492504343953926634992332820282019728792003956564819967]\n", |
| 103 | + "powers_of_2_large_pmautobus [1, 2, 3] ... [57896044618658097711785492504343953926634992332820282019728792003956564819972]\n", |
| 104 | + "powers_of_3 [3, 9, 27] ... [1162261467]\n", |
| 105 | + "all [1, 2, 3] ... [173688133855974293135356477513031861779904976998460846059186376011869694459904]\n" |
| 106 | + ] |
| 107 | + } |
| 108 | + ], |
86 | 109 | "source": [ |
87 | 110 | "from epare.divisors import divisor_map\n", |
88 | 111 | "for d, ds in divisor_map.items():\n", |
|
100 | 123 | }, |
101 | 124 | { |
102 | 125 | "cell_type": "code", |
103 | | - "execution_count": null, |
| 126 | + "execution_count": 4, |
104 | 127 | "id": "19d986ab-5fe7-4dd6-b5b5-4e75307217d6", |
105 | 128 | "metadata": {}, |
106 | 129 | "outputs": [], |
|
137 | 160 | "plot_divisors = divisor_map[\"small_primes\"]\n", |
138 | 161 | "\n", |
139 | 162 | "# Here are several useful filters when playing around with the data. We want to select a single multiplier and countereasure combination.\n", |
140 | | - "only_ltr_example = lambda config: config.mult.klass == LTRMultiplier and not config.mult.kwargs[\"always\"] and not config.mult.kwargs[\"complete\"]\n", |
141 | | - "only_rtl_example = lambda config: config.mult.klass == RTLMultiplier and not config.mult.kwargs[\"always\"] and not config.mult.kwargs[\"complete\"]\n", |
142 | | - "only_sliding_example = lambda config: config.mult.klass == SlidingWindowMultiplier and config.mult.kwargs[\"width\"] == 4 and config.mult.kwargs[\"recoding_direction\"] == ProcessingDirection.LTR\n", |
143 | | - "only_comb_example = lambda config: config.mult.klass == CombMultiplier and config.mult.kwargs[\"width\"] == 4 and config.mult.kwargs[\"always\"] == True\n", |
144 | | - "single_layer_ctr = lambda config: all(map(lambda ident: isinstance(ident, MultIdent), config.composition.args))\n", |
145 | | - "single_type_ctr = lambda config: all(map(lambda ident: isinstance(ident, MultIdent) or ident.klass == config.composition.klass, config.composition.args))\n", |
146 | | - "single_type_ctr_full = lambda config: all(map(lambda ident: ident.klass == config.composition.klass, config.composition.args))\n", |
| 163 | + "# See the filters module for more.\n", |
| 164 | + "# only_ltr_example\n", |
| 165 | + "# only_rtl_example\n", |
| 166 | + "# only_sliding_example\n", |
| 167 | + "# only_comb_example\n", |
| 168 | + "# single_layer_ctr\n", |
| 169 | + "# single_type_ctr\n", |
| 170 | + "# single_type_ctr_full\n", |
147 | 171 | "\n", |
148 | 172 | "groups = {}\n", |
149 | 173 | "for config, probmap in config_map.items():\n", |
|
234 | 258 | "plot_divisors = divisor_map[\"small_primes\"]\n", |
235 | 259 | "\n", |
236 | 260 | "# Here are several useful filters when playing around with the data. We want to select a single multiplier and error model.\n", |
237 | | - "only_ltr_example = lambda config: config.mult.klass == LTRMultiplier and not config.mult.kwargs[\"always\"] and not config.mult.kwargs[\"complete\"]\n", |
238 | | - "only_rtl_example = lambda config: config.mult.klass == RTLMultiplier and not config.mult.kwargs[\"always\"] and not config.mult.kwargs[\"complete\"]\n", |
239 | | - "only_sliding_example = lambda config: config.mult.klass == SlidingWindowMultiplier and config.mult.kwargs[\"width\"] == 4 and config.mult.kwargs[\"recoding_direction\"] == ProcessingDirection.LTR\n", |
240 | | - "only_comb_example = lambda config: config.mult.klass == CombMultiplier and config.mult.kwargs[\"width\"] == 4 and config.mult.kwargs[\"always\"] == True\n", |
241 | | - "\n", |
242 | | - "fixed_error_model = lambda config: config.error_model == ErrorModel({\"divides\"}, \"all\", True)\n", |
243 | | - "single_layer_ctr = lambda config: all(map(lambda ident: isinstance(ident, MultIdent), config.composition.args))\n", |
244 | | - "single_type_ctr = lambda config: all(map(lambda ident: isinstance(ident, MultIdent) or ident.klass == config.composition.klass, config.composition.args))\n", |
245 | | - "single_type_ctr_full = lambda config: all(map(lambda ident: ident.klass == config.composition.klass, config.composition.args))\n", |
| 261 | + "# See the filters module for more.\n", |
| 262 | + "# only_ltr_example\n", |
| 263 | + "# only_rtl_example\n", |
| 264 | + "# only_sliding_example\n", |
| 265 | + "# only_comb_example\n", |
| 266 | + "# fixed_error_model\n", |
| 267 | + "# single_layer_ctr\n", |
| 268 | + "# single_type_ctr\n", |
| 269 | + "# single_type_ctr_full\n", |
246 | 270 | "\n", |
247 | 271 | "groups = {}\n", |
248 | 272 | "for config, probmap in config_map.items():\n", |
|
324 | 348 | "plot_divisors = divisor_map[\"small_primes\"]\n", |
325 | 349 | "\n", |
326 | 350 | "# Here are several useful filters when playing around with the data. We want to select a single countermeasure config and error_model\n", |
327 | | - "only_ltrs = lambda config: config.mult.klass == LTRMultiplier\n", |
328 | | - "only_rtls = lambda config: config.mult.klass == RTLMultiplier\n", |
329 | | - "only_slidings = lambda config: config.mult.klass == SlidingWindowMultiplier\n", |
330 | | - "only_combs = lambda config: config.mult.klass == CombMultiplier\n", |
331 | | - "no_combs = lambda config: config.mult.klass not in (CombMultiplier, BGMWMultiplier)\n", |
332 | | - "\n", |
333 | | - "fixed_error_model = lambda config: config.error_model == ErrorModel({\"divides\"}, \"all\", True)\n", |
334 | | - "fixed_no_countermeasure = lambda config: isinstance(config.composition, MultIdent)\n", |
335 | | - "fixed_gsr_countermeasure = lambda config: config.composition.klass == GroupScalarRandomization\n", |
| 351 | + "# See the filters module for more.\n", |
| 352 | + "# only_ltrs\n", |
| 353 | + "# only_rtls\n", |
| 354 | + "# only_slidingws\n", |
| 355 | + "# only_combs\n", |
| 356 | + "# no_combs\n", |
| 357 | + "# fixed_error_model\n", |
| 358 | + "# fixed_no_countermeasure\n", |
| 359 | + "# single_layer_ctr\n", |
| 360 | + "# single_type_ctr\n", |
| 361 | + "# single_type_ctr_full\n", |
| 362 | + "# has_gsr\n", |
336 | 363 | "\n", |
337 | 364 | "groups = {}\n", |
338 | 365 | "for config, probmap in config_map.items():\n", |
|
426 | 453 | "plot_divisors = divisor_map[\"small_primes\"]\n", |
427 | 454 | "\n", |
428 | 455 | "# Here are several useful filters when playing around with the data. We want to select a single countermeasure config and error_model\n", |
429 | | - "only_ltrs = lambda config: config.mult.klass == LTRMultiplier\n", |
430 | | - "only_rtls = lambda config: config.mult.klass == RTLMultiplier\n", |
431 | | - "only_slidings = lambda config: config.mult.klass == SlidingWindowMultiplier\n", |
432 | | - "only_combs = lambda config: config.mult.klass == CombMultiplier\n", |
| 456 | + "# See the filters module for more.\n", |
| 457 | + "# only_ltrs\n", |
| 458 | + "# only_rtls\n", |
| 459 | + "# only_slidingws\n", |
| 460 | + "# only_combs\n", |
| 461 | + "# no_combs\n", |
| 462 | + "# fixed_error_model\n", |
| 463 | + "# fixed_no_countermeasure\n", |
| 464 | + "# single_layer_ctr\n", |
| 465 | + "# single_type_ctr\n", |
| 466 | + "# single_type_ctr_full\n", |
| 467 | + "# has_gsr\n", |
433 | 468 | "\n", |
434 | | - "fixed_error_model = lambda config: config.error_model == ErrorModel({\"divides\"}, \"all\", True)\n", |
435 | | - "fixed_no_countermeasure = lambda config: isinstance(config.composition, MultIdent)\n", |
436 | | - "fixed_gsr_countermeasure = lambda config: config.composition.klass == GroupScalarRandomization\n", |
437 | 469 | "\n", |
438 | 470 | "groups = {}\n", |
439 | 471 | "for config, probmap in config_map.items():\n", |
440 | | - " if fixed_error_model(config) and fixed_no_countermeasure(config) and only_slidings(config):\n", |
| 472 | + " if fixed_error_model(config) and fixed_no_countermeasure(config) and only_slidingws(config):\n", |
441 | 473 | " plot_configs.append(config)\n", |
442 | 474 | " pmap = deepcopy(probmap)\n", |
443 | 475 | " pmap.narrow(plot_divisors)\n", |
|
495 | 527 | "plt.close();" |
496 | 528 | ] |
497 | 529 | }, |
| 530 | + { |
| 531 | + "cell_type": "markdown", |
| 532 | + "id": "7995e2b5-550e-423e-b51c-f40f10c66cc3", |
| 533 | + "metadata": {}, |
| 534 | + "source": [ |
| 535 | + "## Misc (broken)" |
| 536 | + ] |
| 537 | + }, |
498 | 538 | { |
499 | 539 | "cell_type": "code", |
500 | 540 | "execution_count": null, |
|
0 commit comments