├── .gitignore ├── assets ├── 00-cables-and-inputs │ ├── 001-input-keyboard-click-remapping.png │ ├── 002-input-mouse-click-remapping.png │ ├── 003-input-mouse-move.png │ ├── 004-input-move-vs.-click.png │ ├── 005-all-input-types.png │ ├── 006-cable-extension.png │ ├── 007-.png │ ├── 007-response-time-median-vs.-num-samples.png │ ├── data.json │ └── properties.json └── 01-nvidia-reflex │ ├── 001-baseline.png │ ├── 002-different-locations.png │ ├── 003-different-sessions.png │ ├── 004-gpu-overclock.png │ ├── 005-gsync.png │ ├── 006-gsync-split-fps-range.png │ ├── 007-reduce-buffering.png │ ├── 008-nvidia-reflex-cpu-limited.png │ ├── 009-nvidia-reflex-cpu-limited-boost.png │ ├── 010-nvidia-reflex-cpu-limited-no-gpu-oc-boost.png │ ├── 011-cpu-limited-boost-vs-oc.png │ ├── 012-gpu-limited.png │ ├── 013-gpu-limited-nvidia-reflex-enabled.png │ ├── 014-gpu-limited-nvidia-reflex.png │ ├── 015-gpu-limited-nvidia-reflex-no-oc.png │ ├── 016-gpu-limited-nvidia-reflex-boost-vs-oc.png │ ├── 017-gpu-limited-reduce-buffering-off-nvidia-reflex.png │ ├── 018-gpu-limited-nvidia-reflex-enabled-reduce-buffering.png │ ├── 019-low-latency-mode-reflex-enabled.png │ ├── 020-nvidia-reflex-cpu-limited-measurement-2.png │ ├── 021-nvidia-reflex-gpu-limited-measurement-2.png │ ├── 022-reflex-mis-prediction.png │ ├── backpressure.png │ ├── backpressure.psd │ ├── buffering.png │ ├── buffering.psd │ ├── data.json │ ├── diytest.png │ ├── diytest.psd │ └── properties.json ├── code ├── ResponseTimeTester │ ├── ResponseTimeTester.atsln │ ├── ResponseTimeTester.atsuo │ └── ResponseTimeTester │ │ ├── ResponseTimeTester.cproj │ │ ├── boardtest.c │ │ ├── boardtest.h │ │ ├── io │ │ ├── adc.c │ │ ├── adc.h │ │ ├── buttons.c │ │ ├── buttons.h │ │ ├── uart.c │ │ └── uart.h │ │ ├── main.c │ │ ├── pinconfig.c │ │ ├── pinconfig.h │ │ ├── sample.c │ │ └── sample.h └── matlab │ ├── LagData.m │ ├── colors │ ├── kb_bcg.m │ ├── kb_bgry.m │ ├── kb_bgy_dark.m │ ├── kb_bgy_light.m │ ├── kb_bmrygcw.m │ ├── kb_bw.m │ ├── kb_mbcgy.m │ ├── kb_mry_dark.m │ ├── kb_mry_light.m │ ├── kb_mrygc.m │ └── qual_seq.m │ ├── main_lag.m │ ├── main_lag_00.m │ ├── main_lag_01.m │ ├── main_lag_init.m │ └── util │ ├── addLabel.m │ ├── consecutive.m │ ├── filenameify.m │ ├── geometricBracket.m │ ├── legendColorItem.m │ ├── limit.m │ ├── map.m │ ├── natsort.m │ ├── rescale.m │ ├── saveFig.m │ ├── saveOpenFigs.m │ └── withinPrctiles.m ├── inputUtils ├── OWFPSChanger.d ├── f7remap.d ├── interception │ ├── cport │ │ ├── interception.dll │ │ ├── interception.lib │ │ ├── interceptiond.d │ │ └── remap_interception.d │ └── interceptiond.d └── mousemeasure.d └── text ├── 01-variation.md └── 02-reflex.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | code/ResponseTimeTester/ResponseTimeTester/Debug/* -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/001-input-keyboard-click-remapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/001-input-keyboard-click-remapping.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/002-input-mouse-click-remapping.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/002-input-mouse-click-remapping.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/003-input-mouse-move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/003-input-mouse-move.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/004-input-move-vs.-click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/004-input-move-vs.-click.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/005-all-input-types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/005-all-input-types.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/006-cable-extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/006-cable-extension.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/007-.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/007-.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/007-response-time-median-vs.-num-samples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/00-cables-and-inputs/007-response-time-median-vs.-num-samples.png -------------------------------------------------------------------------------- /assets/00-cables-and-inputs/properties.json: -------------------------------------------------------------------------------- 1 | [ 2 | "game settings", 3 | ["Game", "Overwatch", []], 4 | ["Patch", "", []], 5 | ["Render scale", "100%", "^\\d+%$"], 6 | ["Reduce buffering", "On", ["On", "Off"]], 7 | ["Nvidia reflex", "Disabled", ["Disabled", "Enabled", "Enabled + Boost"]], 8 | ["VSync", "Off", ["On", "Off"]], 9 | ["Triple buffering", "Off", ["On", "Off"]], 10 | ["Resolution", "2560x1440", "^\\d+x\\d+$"], 11 | ["Engine FPS limit", "400", "^\\d+$"], 12 | ["Engine tick rate", "62.5 Hz", "^\\d+\\.?\\d* Hz$"], 13 | ["In-game location", "", []], 14 | 15 | "Compare to max (uncapped) fps", 16 | ["Software FPS limit", "Game", ["Game", "RTSS", "None"]], 17 | ["Hardware FPS limit", "None", ["CPU", "GPU", "VSync", "None"]], 18 | ["Hardware max FPS", "-1", "^-1$|^\\d+$"], 19 | 20 | "input device settings", 21 | ["Input device", "Mouse", ["Mouse", "Keyboard"]], 22 | ["Input device polling rate", "1000 Hz", "^\\d+ Hz$"], 23 | ["Input from hardware", "(undefined)", ["(undefined)", "Mouse move", "Mouse click", "Key click"]], 24 | ["Input remapping", "None", ["None", "Interception", "Winuser", "iCUE 3.21", "iCUE 2.24"]], 25 | ["Input to game", "None", ["None", "Mouse move", "Mouse click", "Key click"]], 26 | 27 | "display settings", 28 | ["Display", "AG271QG", ["AG271QG", "PG279"]], 29 | ["Refresh rate", "165 Hz", "^\\d+ Hz$"], 30 | ["GSync", "Off", ["On", "Off"]], 31 | ["Scaling mode", "Display", ["Display", "GPU", "Integer", "None"]], 32 | 33 | "control panel settings", 34 | ["Max pre-rendered frames", "Application defined", "^Application defined$|^\\d$"], 35 | ["Low latency mode", "Off", ["On", "Off", "Ultra"]], 36 | ["GPU power mode", "Prefer maximum performance",["Optimal power", "Adaptive", "Prefer maximum performance"]], 37 | ["Windows power mode", "High performance", ["High performance", "Balanced"]], 38 | ["Scheduler priority", "8 (Normal)", ["4 (Idle)", "8 (Normal)", "13 (High)", "24 (Realtime)"]], 39 | 40 | "disturbances", 41 | ["Disturbance", "None", ["None", "OBS"]], 42 | ["OBS setting", "Off", ["off", "x264", "NVENC", "x264 overloaded"]], 43 | ["OBS scheduler priority", "8 (Normal)", ["4 (Idle)", "8 (Normal)", "13 (High)", "24 (Realtime)"]], 44 | 45 | "photodiode settings", 46 | ["Input frequency", "None", "^None|$^\\d+\\.?\\d* Hz$"], 47 | ["Sensor screen location", "Middle", ["Top", "Middle", "Bottom"]], 48 | 49 | "system settings", 50 | ["PC", "Desktop", ["Desktop", "Laptop"]], 51 | ["Operating system", "Windows 7", ["Windows 7", "Windows 10"]], 52 | ["Microcode", "0x22", ["0x22", "0x24"]], 53 | ["Meltdown protection", "Disabled", ["Enabled", "Disabled"]], 54 | ["Spectre protection", "Disabled", ["Enabled", "Disabled"]], 55 | ["QPC Clock source", "TSC", ["TSC", "HPET", "APIC"]], 56 | 57 | "hardware settings", 58 | ["GPU", "GTX 1080", []], 59 | ["GPU Core clock", "2025 MHz", "^Auto$|^\\d+ MHz$"], 60 | ["GPU Memory clock", "5300 MHz", "^Auto$|^\\d+ MHz$"], 61 | ["CPU", "i7-5820K", []], 62 | ["CPU Cores", "6", "^\\d+$"], 63 | ["CPU Threads", "12", "^\\d+$"], 64 | ["CPU Clock speed", "4.4 GHz", "^\\d+\\.?\\d* GHz$"], 65 | ["Memory Channels", "Quad", ["Single", "Dual", "Triple", "Quad"]], 66 | ["Memory Frequency", "1333 MHz", "^\\d+ MHz$"], 67 | ["Memory Timings", "13-13-13-30-2T", "^(\\d+-)[4]\\dT$"], 68 | 69 | "post-search settings", 70 | ["FPS selection", "all", []], 71 | 72 | "other", 73 | ["15m extended cables", "(undefined)", ["(undefined)", "None", "USB", "DP", "USB + DP"]], 74 | ["misc", "", []] 75 | ] -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/001-baseline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/001-baseline.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/002-different-locations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/002-different-locations.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/003-different-sessions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/003-different-sessions.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/004-gpu-overclock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/004-gpu-overclock.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/005-gsync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/005-gsync.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/006-gsync-split-fps-range.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/006-gsync-split-fps-range.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/007-reduce-buffering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/007-reduce-buffering.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/008-nvidia-reflex-cpu-limited.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/008-nvidia-reflex-cpu-limited.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/009-nvidia-reflex-cpu-limited-boost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/009-nvidia-reflex-cpu-limited-boost.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/010-nvidia-reflex-cpu-limited-no-gpu-oc-boost.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/010-nvidia-reflex-cpu-limited-no-gpu-oc-boost.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/011-cpu-limited-boost-vs-oc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/011-cpu-limited-boost-vs-oc.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/012-gpu-limited.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/012-gpu-limited.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/013-gpu-limited-nvidia-reflex-enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/013-gpu-limited-nvidia-reflex-enabled.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/014-gpu-limited-nvidia-reflex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/014-gpu-limited-nvidia-reflex.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/015-gpu-limited-nvidia-reflex-no-oc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/015-gpu-limited-nvidia-reflex-no-oc.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/016-gpu-limited-nvidia-reflex-boost-vs-oc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/016-gpu-limited-nvidia-reflex-boost-vs-oc.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/017-gpu-limited-reduce-buffering-off-nvidia-reflex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/017-gpu-limited-reduce-buffering-off-nvidia-reflex.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/018-gpu-limited-nvidia-reflex-enabled-reduce-buffering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/018-gpu-limited-nvidia-reflex-enabled-reduce-buffering.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/019-low-latency-mode-reflex-enabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/019-low-latency-mode-reflex-enabled.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/020-nvidia-reflex-cpu-limited-measurement-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/020-nvidia-reflex-cpu-limited-measurement-2.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/021-nvidia-reflex-gpu-limited-measurement-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/021-nvidia-reflex-gpu-limited-measurement-2.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/022-reflex-mis-prediction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/022-reflex-mis-prediction.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/backpressure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/backpressure.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/backpressure.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/backpressure.psd -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/buffering.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/buffering.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/buffering.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/buffering.psd -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/diytest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/diytest.png -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/diytest.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/assets/01-nvidia-reflex/diytest.psd -------------------------------------------------------------------------------- /assets/01-nvidia-reflex/properties.json: -------------------------------------------------------------------------------- 1 | [ 2 | "game settings", 3 | ["Game", "Overwatch", []], 4 | ["Patch", "1.59.0.0", []], 5 | ["Render scale", "100%", "^\\d+%$"], 6 | ["Reduce buffering", "On", ["On", "Off"]], 7 | ["Nvidia reflex", "Disabled", ["Disabled", "Enabled", "Enabled + Boost"]], 8 | ["VSync", "Off", ["On", "Off"]], 9 | ["Triple buffering", "Off", ["On", "Off"]], 10 | ["Resolution", "2560x1440", "^\\d+x\\d+$"], 11 | ["Engine FPS limit", "400", "^\\d+$"], 12 | ["Engine tick rate", "62.5 Hz", "^\\d+\\.?\\d* Hz$"], 13 | ["In-game location", "", []], 14 | 15 | "Compare to max (uncapped) fps", 16 | ["Software FPS limit", "Game", ["Game", "RTSS", "None"]], 17 | ["Hardware FPS limit", "None", ["CPU", "GPU", "VSync", "None"]], 18 | ["Hardware max FPS", "-1", "^-1$|^\\d+$"], 19 | 20 | "input device settings", 21 | ["Input device", "Mouse", ["Mouse", "Keyboard"]], 22 | ["Input device polling rate", "1000 Hz", "^\\d+ Hz$"], 23 | ["Input from hardware", "Mouse click", ["(undefined)", "Mouse move", "Mouse click", "Key click"]], 24 | ["Input remapping", "Interception", ["None", "Interception", "Winuser", "iCUE 3.21", "iCUE 2.24"]], 25 | ["Input to game", "Mouse move", ["None", "Mouse move", "Mouse click", "Key click"]], 26 | 27 | "display settings", 28 | ["Display", "AG271QG", ["AG271QG", "PG279"]], 29 | ["Refresh rate", "165 Hz", "^\\d+ Hz$"], 30 | ["GSync", "On", ["On", "Off"]], 31 | ["Scaling mode", "Display", ["Display", "GPU", "Integer", "None"]], 32 | 33 | "control panel settings", 34 | ["Max pre-rendered frames", "Application defined", "^Application defined$|^\\d$"], 35 | ["Low latency mode", "Off", ["On", "Off", "Ultra"]], 36 | ["GPU power mode", "Prefer maximum performance",["Optimal power", "Adaptive", "Prefer maximum performance"]], 37 | ["Windows power mode", "High performance", ["High performance", "Balanced"]], 38 | ["Scheduler priority", "8 (Normal)", ["4 (Idle)", "8 (Normal)", "13 (High)", "24 (Realtime)"]], 39 | 40 | "disturbances", 41 | ["Disturbance", "None", ["None", "OBS"]], 42 | ["OBS setting", "Off", ["off", "x264", "NVENC", "x264 overloaded"]], 43 | ["OBS scheduler priority", "8 (Normal)", ["4 (Idle)", "8 (Normal)", "13 (High)", "24 (Realtime)"]], 44 | 45 | "photodiode settings", 46 | ["Input frequency", "None", "^None|$^\\d+\\.?\\d* Hz$"], 47 | ["Sensor screen location", "Middle", ["Top", "Middle", "Bottom"]], 48 | 49 | "system settings", 50 | ["PC", "Desktop", ["Desktop", "Laptop"]], 51 | ["Operating system", "Windows 7", ["Windows 7", "Windows 10"]], 52 | ["Microcode", "0x22", ["0x22", "0x24"]], 53 | ["Meltdown protection", "Disabled", ["Enabled", "Disabled"]], 54 | ["Spectre protection", "Disabled", ["Enabled", "Disabled"]], 55 | ["QPC Clock source", "TSC", ["TSC", "HPET", "APIC"]], 56 | 57 | "hardware settings", 58 | ["GPU", "GTX 1080", []], 59 | ["GPU Core clock", "2025 MHz", "^Auto$|^\\d+ MHz$"], 60 | ["GPU Memory clock", "5300 MHz", "^Auto$|^\\d+ MHz$"], 61 | ["CPU", "i7-5820K", []], 62 | ["CPU Cores", "6", "^\\d+$"], 63 | ["CPU Threads", "12", "^\\d+$"], 64 | ["CPU Clock speed", "4.4 GHz", "^\\d+\\.?\\d* GHz$"], 65 | ["Memory Channels", "Quad", ["Single", "Dual", "Triple", "Quad"]], 66 | ["Memory Frequency", "1333 MHz", "^\\d+ MHz$"], 67 | ["Memory Timings", "13-13-13-30-2T", "^(\\d+-)[4]\\dT$"], 68 | 69 | "post-search settings", 70 | ["FPS selection", "all", []], 71 | 72 | "other", 73 | ["15m extended cables", "USB + DP", ["(undefined)", "None", "USB", "DP", "USB + DP"]], 74 | ["misc", "", []] 75 | ] -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester.atsln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Atmel Studio Solution File, Format Version 11.00 4 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "ResponseTimeTester", "ResponseTimeTester\ResponseTimeTester.cproj", "{A64FC18C-5777-4FAB-B7FC-02C8D17CEC21}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|AVR = Debug|AVR 9 | Release|AVR = Release|AVR 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {A64FC18C-5777-4FAB-B7FC-02C8D17CEC21}.Debug|AVR.ActiveCfg = Debug|AVR 13 | {A64FC18C-5777-4FAB-B7FC-02C8D17CEC21}.Debug|AVR.Build.0 = Debug|AVR 14 | {A64FC18C-5777-4FAB-B7FC-02C8D17CEC21}.Release|AVR.ActiveCfg = Release|AVR 15 | {A64FC18C-5777-4FAB-B7FC-02C8D17CEC21}.Release|AVR.Build.0 = Release|AVR 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester.atsuo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/code/ResponseTimeTester/ResponseTimeTester.atsuo -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/ResponseTimeTester.cproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 2.0 5 | 6.2 6 | com.Atmel.AVRGCC8.C 7 | {a64fc18c-5777-4fab-b7fc-02c8d17cec21} 8 | AT90USB1287 9 | none 10 | Executable 11 | C 12 | $(MSBuildProjectName) 13 | .elf 14 | $(MSBuildProjectDirectory)\$(Configuration) 15 | ResponseTimeTester 16 | ResponseTimeTester 17 | ResponseTimeTester 18 | Native 19 | true 20 | false 21 | true 22 | true 23 | 0x20000000 24 | 25 | true 26 | exception_table 27 | 2 28 | 0 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | com.atmel.avrdbg.tool.atmelice 42 | 43 | 44 | 45 | 200000 46 | 47 | JTAG 48 | 49 | com.atmel.avrdbg.tool.atmelice 50 | J41800001443 51 | Atmel-ICE 52 | 53 | JTAG 54 | 55 | 56 | 57 | 58 | True 59 | True 60 | True 61 | True 62 | True 63 | False 64 | True 65 | True 66 | 67 | 68 | NDEBUG 69 | 70 | 71 | Optimize for size (-Os) 72 | True 73 | True 74 | True 75 | 76 | 77 | libm 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | True 87 | True 88 | True 89 | True 90 | True 91 | False 92 | True 93 | True 94 | 95 | 96 | DEBUG 97 | F_CPU=16000000 98 | UART_BAUD=57600 99 | 100 | 101 | Optimize for size (-Os) 102 | True 103 | True 104 | Default (-g2) 105 | True 106 | True 107 | True 108 | 109 | 110 | libm 111 | 112 | 113 | -lprintf_flt 114 | Default (-Wa,-g) 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | compile 124 | 125 | 126 | compile 127 | 128 | 129 | compile 130 | 131 | 132 | compile 133 | 134 | 135 | compile 136 | 137 | 138 | compile 139 | 140 | 141 | compile 142 | 143 | 144 | compile 145 | 146 | 147 | compile 148 | 149 | 150 | compile 151 | 152 | 153 | compile 154 | 155 | 156 | compile 157 | 158 | 159 | compile 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/boardtest.c: -------------------------------------------------------------------------------- 1 | #include "boardtest.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "io/uart.h" 7 | #include "io/buttons.h" 8 | #include "io/adc.h" 9 | 10 | #include "pinconfig.h" 11 | 12 | void doTestADCChans(){ 13 | led_set(0, 1); 14 | adc_init_single(); 15 | TCCR3B = 1; 16 | while(1){ 17 | _delay_ms(50); 18 | uart_printf("\n"); 19 | for(uint8_t chan = 0; chan <= 2; chan++){ 20 | uint8_t thresh = (chan == 0) ? keyboardThresh : diodeThresh; 21 | TCNT3 = 0; 22 | uint8_t v = adc_read_single(chan); 23 | uint8_t t = TCNT3; 24 | uart_printf("%d %3d %3d %s: ", chan, t, v, (v > thresh) ? "#" : "-"); 25 | for(uint8_t i = 1; i < v/4; i++){ 26 | uart_printf("#"); 27 | } 28 | uart_printf("\n"); 29 | } 30 | if(switch_read(2)){ 31 | diodeThresh *= 2; 32 | if(diodeThresh == 0){ diodeThresh = 1; } 33 | uart_printf("diode threshold: %d\n", diodeThresh); 34 | while(switch_read(2)){} 35 | } 36 | if(switch_read(1)){ 37 | keyboardThresh *= 2; 38 | if(keyboardThresh == 0){ keyboardThresh = 1; } 39 | uart_printf("keyboard threshold: %d\n", keyboardThresh); 40 | while(switch_read(1)){} 41 | } 42 | if(switch_read(0)){ 43 | while(switch_read(0)){} 44 | led_set(0, 0); 45 | return; 46 | } 47 | } 48 | } 49 | 50 | void doTestMouseButton(uint8_t btn){ 51 | led_set(0, 1); 52 | uint8_t prettyBtn = (btn == MOUSE4) ? 4 : 5; 53 | uart_printf( 54 | "Mouse button test:\n" 55 | " 2: Mouse%d down\n" 56 | " 1: Mouse%d up\n" 57 | " 0: return\n", prettyBtn, prettyBtn); 58 | while(1){ 59 | switch(switch_wait()){ 60 | case 3: 61 | break; 62 | case 2: 63 | DDRD |= (1 << btn); 64 | break; 65 | case 1: 66 | DDRD &= ~(1 << btn); 67 | break; 68 | case 0: 69 | led_set(0, 0); 70 | return; 71 | } 72 | } 73 | } 74 | 75 | void doBoardTestMode(){ 76 | while(1){ 77 | uart_printf( 78 | "Test mode:\n" 79 | " 3: Read ADC channels\n" 80 | " 2: Mouse5\n" 81 | " 1: Mouse4\n" 82 | " 0: return\n"); 83 | switch(switch_wait()){ 84 | case 3: 85 | doTestADCChans(); 86 | break; 87 | case 2: 88 | doTestMouseButton(MOUSE5); 89 | break; 90 | case 1: 91 | doTestMouseButton(MOUSE4); 92 | break; 93 | case 0: 94 | return; 95 | } 96 | } 97 | } -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/boardtest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | void doBoardTestMode(); 6 | 7 | void doTestADCChans(); 8 | void doTestMouseButton(uint8_t btn); -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/io/adc.c: -------------------------------------------------------------------------------- 1 | #include "adc.h" 2 | 3 | // ADCFreq = CPUFreq / 2^prescalerbits 4 | // prescaler bits range: [1..7] 5 | // eg: 16MHz / 2^5 = 16MHz/32 = 500KHz 6 | #define ADCPrescalerBits 7 7 | 8 | #ifndef ADHSM 9 | #define ADHSM 7 10 | #endif 11 | 12 | void adc_init_freerun(uint8_t channelSelection){ 13 | ADCSRA = (1< 4 | 5 | void adc_init_freerun(uint8_t channelSelection); 6 | uint8_t adc_read_freerun(void); 7 | void adc_init_single(void); 8 | uint8_t adc_read_single(uint8_t channelSelection); -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/io/buttons.c: -------------------------------------------------------------------------------- 1 | 2 | #include "buttons.h" 3 | #include "uart.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | __attribute__((constructor)) void buttons_init(void){ 12 | DDRB = (1< 3){ 18 | return 0; 19 | } 20 | 21 | return !( PINB & (1 << (switch_id*2 + 1)) ); 22 | } 23 | 24 | void led_set(uint8_t led_id, uint8_t value){ 25 | if(led_id > 3){ 26 | return; 27 | } 28 | 29 | if(value){ 30 | PORTB &= ~(1 << (led_id*2)); 31 | } else { 32 | PORTB |= (1 << (led_id*2)); 33 | } 34 | } 35 | 36 | 37 | //ISR(PCINT0_vect){ 38 | // sleep_disable(); 39 | //} 40 | 41 | 42 | uint8_t switch_wait(){ 43 | 44 | //PCICR = 1; 45 | //PCMSK0 = 0xaa; 46 | //sei(); 47 | //_delay_ms(1); 48 | 49 | while(1){ 50 | //set_sleep_mode(SLEEP_MODE_PWR_DOWN); 51 | //sleep_enable(); 52 | //sleep_cpu(); 53 | 54 | for(uint8_t i = 0; i < 4; i++){ 55 | if(switch_read(i)){ 56 | _delay_ms(5); 57 | while(switch_read(i)){} 58 | _delay_ms(5); 59 | //cli(); 60 | return i; 61 | } 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/io/buttons.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | uint8_t switch_read(uint8_t switch_id); 6 | void led_set(uint8_t led_id, uint8_t value); 7 | uint8_t switch_wait(); -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/io/uart.c: -------------------------------------------------------------------------------- 1 | #include "uart.h" 2 | 3 | #include 4 | #include 5 | 6 | #define ubrr (F_CPU/16/UART_BAUD - 1) 7 | 8 | static FILE uart_stdout = FDEV_SETUP_STREAM((int(*)(char, struct __file *))uart_putchar, NULL, _FDEV_SETUP_WRITE); 9 | 10 | void uart_init(void){ 11 | UBRR1 = (unsigned long)(ubrr); 12 | 13 | UCSR1B |= (1< 2 | #include 3 | #include 4 | #include 5 | 6 | #include "io/uart.h" 7 | #include "io/buttons.h" 8 | #include "io/adc.h" 9 | 10 | #include "pinconfig.h" 11 | #include "sample.h" 12 | #include "boardtest.h" 13 | 14 | 15 | 16 | 17 | 18 | EEMEM uint32_t seed; 19 | uint32_t unpredictableSeed(void){ 20 | uint32_t i; 21 | eeprom_read_block(&i, &seed, sizeof(seed)); 22 | i = rand_r(&i); 23 | eeprom_write_block(&i, &seed, sizeof(seed)); 24 | return i; 25 | } 26 | 27 | 28 | 29 | 30 | int main(void){ 31 | uart_init(); 32 | uart_printf("\nstarted\n"); 33 | srand(unpredictableSeed()); 34 | 35 | uint16_t fpsRange[19] = {400, 346, 300, 260, 225, 195, 169, 146, 128, 110, 95, 82, 71, 62, 53, 46, 40, 35, 30}; 36 | uint8_t fpsRangeStart = 0; 37 | uint8_t fpsRangeEnd = 12; 38 | 39 | while(1){ 40 | uart_printf( 41 | "Main:\n" 42 | " 3: Auto input\n" 43 | " 2: Auto input fps range\n" 44 | " 1: Manual input\n" 45 | " 0: Board test mode\n"); 46 | switch(switch_wait()){ 47 | case 3:{ 48 | AutoSampleSettings s = doMakeAutoSampleSettings(); 49 | led_set(3, 1); 50 | doSampleAuto(&s); 51 | led_set(3, 0); 52 | break; 53 | } 54 | case 2:{ 55 | AutoSampleSettings s = doMakeAutoSampleSettings(); 56 | doMakeFPSRange(fpsRange, sizeof(fpsRange)/sizeof(fpsRange[0]), &fpsRangeStart, &fpsRangeEnd); 57 | 58 | led_set(2, 1); 59 | doSampleFPSRangeAuto(s, &fpsRange[fpsRangeStart], fpsRangeEnd-fpsRangeStart); 60 | led_set(2, 0); 61 | break; 62 | } 63 | case 1:{ 64 | ManualSampleSettings s = doMakeManualSampleSettings(); 65 | doMakeFPSRange(fpsRange, sizeof(fpsRange)/sizeof(fpsRange[0]), &fpsRangeStart, &fpsRangeEnd); 66 | 67 | led_set(1, 1); 68 | doSampleFPSRangeManual(s, &fpsRange[fpsRangeStart], fpsRangeEnd-fpsRangeStart); 69 | led_set(1, 0); 70 | break; 71 | } 72 | case 0: 73 | doBoardTestMode(); 74 | break; 75 | } 76 | } 77 | while(1){} 78 | } 79 | 80 | -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/pinconfig.c: -------------------------------------------------------------------------------- 1 | #include "pinconfig.h" 2 | 3 | void pin_init(uint8_t button, BtnIO io){ 4 | switch(io){ 5 | case B_write: 6 | PORTD &= ~(1< 4 | 5 | // Mouse buttons and photodiodes are on PORT D 6 | // Buttons can be triggered by the controller (write), or triggered by hand and read by the controller (read) 7 | // Keyboard button must be RC-filtered and read with ADC 8 | 9 | #define DIODE1 4 10 | #define DIODE1_READ (PIND & (1< 10 | #include 11 | #include 12 | #include 13 | 14 | float timerPrescalerToResolutionMs(uint8_t prescaler){ 15 | return pow(2, 2*prescaler) / (F_CPU/1000); 16 | } 17 | 18 | void doMakeFPSRange(uint16_t* fpsRange, uint8_t fpsRangeSize, uint8_t* low, uint8_t* high){ 19 | #define set_low 0 20 | #define set_high 1 21 | uint8_t setting = 0; 22 | led_set(0, 1); 23 | while(1){ 24 | uart_printf("Range: %3d%s%3d\n", fpsRange[*low], (setting == set_low) ? ".- " : " -.", fpsRange[*high]); 25 | switch(switch_wait()){ 26 | case 3: 27 | if(setting == set_low){ 28 | (*low)--; 29 | if(*low == 0xff){ 30 | *low = 0; 31 | } 32 | } else { 33 | (*high)--; 34 | if(*high < *low){ 35 | (*high)++; 36 | } 37 | } 38 | break; 39 | case 2: 40 | if(setting == set_low){ 41 | (*low)++; 42 | if(*low > fpsRangeSize){ 43 | *low = 0; 44 | } 45 | if(*low > *high){ 46 | (*low)--; 47 | } 48 | } else { 49 | (*high)++; 50 | if(*high >= fpsRangeSize){ 51 | (*high)--; 52 | } 53 | } 54 | break; 55 | case 1: 56 | setting = (setting == set_low) ? set_high : set_low; 57 | break; 58 | case 0: 59 | led_set(0, 0); 60 | return; 61 | } 62 | } 63 | } 64 | 65 | void doSampleFPSRange(void* settings, uint16_t* fpsRange, uint8_t fpsRangeSize, void doBetween(void*), void doSample(void*)){ 66 | uart_printf(" {\n \"properties\": [\n ],\n \"values\": [\n"); 67 | for(uint8_t f = 0; f <= fpsRangeSize; f++){ 68 | if(f != 0){ 69 | doBetween(settings); 70 | } 71 | 72 | uart_printf(" {\"fps\": %3d, \"samples\": [", fpsRange[f]); 73 | doSample(settings); 74 | uart_printf("]}%s\n", f==fpsRangeSize ? "" : ","); 75 | } 76 | uart_printf(" ]\n },\n"); 77 | } 78 | 79 | 80 | ManualSampleSettings doMakeManualSampleSettings(){ 81 | static ManualClickType clickType = MCT_keyboard; 82 | uint16_t samples[4] = {5, 20, 50, 100}; 83 | static uint8_t samples_idx = 1; 84 | uint16_t delays[6] = {1, 17, 70, 250, 600, 1100}; 85 | static uint8_t delays_idx = 4; 86 | ManualSampleSettings s = (ManualSampleSettings){ 87 | .clickType = clickType, 88 | .adcChan = ADC_DIODE1, 89 | .samples = samples[samples_idx], 90 | .delay_ms = delays[delays_idx], 91 | }; 92 | uart_printf("Manual sample settings: \n key: %s \n samples: %d \n delay: %d\n", 93 | (s.clickType == MCT_keyboard) ? "keyboard" : (s.clickType == MCT_mouse4) ? "mouse4" : "mouse5", 94 | s.samples, s.delay_ms); 95 | led_set(0, 1); 96 | while(1){ 97 | switch(switch_wait()){ 98 | case 3: 99 | clickType = (s.clickType == MCT_keyboard) ? MCT_mouse4 : 100 | (s.clickType == MCT_mouse4) ? MCT_mouse5 : 101 | MCT_keyboard; 102 | s.clickType = clickType; 103 | uart_printf("key: %\n", (s.clickType == MCT_keyboard) ? "keyboard" : (s.clickType == MCT_mouse4) ? "mouse4" : "mouse5"); 104 | break; 105 | case 2: 106 | samples_idx = (++samples_idx == sizeof(samples)/sizeof(samples[0])) ? 0 : samples_idx; 107 | s.samples = samples[samples_idx]; 108 | uart_printf("samples: %d\n", s.samples); 109 | break; 110 | case 1: 111 | delays_idx = (++delays_idx == sizeof(delays)/sizeof(delays[0])) ? 0 : delays_idx; 112 | s.delay_ms = delays[delays_idx]; 113 | uart_printf("delay: %d\n", s.delay_ms); 114 | break; 115 | case 0: 116 | led_set(0, 0); 117 | return s; 118 | } 119 | } 120 | } 121 | 122 | void doBetweenManual(ManualSampleSettings* s __attribute__((unused))){ 123 | led_set(0, 1); 124 | while(!switch_read(0)){} 125 | led_set(0, 0); 126 | } 127 | 128 | void doSampleManual(ManualSampleSettings* s){ 129 | if(s->clickType == MCT_keyboard){ 130 | TCCR3B = 3; 131 | for(uint8_t iter = 0; iter < s->samples; iter++){ 132 | adc_init_freerun(ADC_KEYBOARD); 133 | _delay_ms(5); 134 | while(adc_read_freerun() > keyboardThresh){} 135 | while(adc_read_freerun() < keyboardThresh){} 136 | TCNT3 = 0; 137 | adc_init_freerun(s->adcChan & 0x03); 138 | 139 | while(adc_read_freerun() < diodeThresh){} 140 | uint16_t t = TCNT3; 141 | 142 | uart_printf("%s%.3f", iter ? ", " : "", t*timerPrescalerToResolutionMs(TCCR3B)); 143 | for(uint16_t i = 0; i < s->delay_ms; i++){ 144 | _delay_ms(1); 145 | } 146 | } 147 | } else { 148 | adc_init_freerun(s->adcChan & 0x03); 149 | pin_init(s->clickType, B_read); 150 | TCCR3B = 3; 151 | 152 | for(uint8_t iter = 0; iter < s->samples; iter++){ 153 | while(PIND & (1 << s->clickType)){} 154 | TCNT3 = 0; 155 | 156 | while(adc_read_freerun() < diodeThresh){} 157 | uint16_t t = TCNT3; 158 | 159 | uart_printf("%s%.3f", iter ? ", " : "", t*timerPrescalerToResolutionMs(TCCR3B)); 160 | while(!(PIND & (1 << s->clickType))){} 161 | for(uint16_t i = 0; i < s->delay_ms; i++){ 162 | _delay_ms(1); 163 | } 164 | } 165 | } 166 | } 167 | 168 | void doSampleFPSRangeManual(ManualSampleSettings s, uint16_t* fpsRange, uint8_t fpsRangeSize){ 169 | doSampleFPSRange(&s, fpsRange, fpsRangeSize, (void(*)(void*))&doBetweenManual, (void(*)(void*))&doSampleManual); 170 | } 171 | 172 | 173 | 174 | AutoSampleSettings doMakeAutoSampleSettings(){ 175 | static uint8_t btn = MOUSE5; 176 | uint16_t samples[6] = {5, 50, 100, 150, 300, 1000}; 177 | static uint8_t samples_idx = 1; 178 | uint16_t delays[7] = {1, 10, 30, 80, 150, 300, 1100}; 179 | static uint8_t delays_idx = 0; 180 | AutoSampleSettings s = (AutoSampleSettings){ 181 | .mouseBtn = btn, 182 | .adcChan = ADC_DIODE1, 183 | .samples = samples[samples_idx], 184 | .delay_ms = delays[delays_idx], 185 | }; 186 | led_set(0, 1); 187 | uart_printf("Auto sample settings: \n mouse button: %s\n samples: %d\n min. delay: %d\n", 188 | (s.mouseBtn == MOUSE4) ? "mouse4" : "mouse5", s.samples, s.delay_ms); 189 | while(1){ 190 | switch(switch_wait()){ 191 | case 3: 192 | btn = (s.mouseBtn == MOUSE4) ? MOUSE5 : MOUSE4; 193 | s.mouseBtn = btn; 194 | uart_printf("button: %s\n", (s.mouseBtn == MOUSE4) ? "mouse4" : "mouse5"); 195 | break; 196 | case 2: 197 | samples_idx = (++samples_idx == sizeof(samples)/sizeof(samples[0])) ? 0 : samples_idx; 198 | s.samples = samples[samples_idx]; 199 | uart_printf("samples: %d\n", s.samples); 200 | break; 201 | case 1: 202 | delays_idx = (++delays_idx == sizeof(delays)/sizeof(delays[0])) ? 0 : delays_idx; 203 | s.delay_ms = delays[delays_idx]; 204 | uart_printf("delay: %d\n", s.delay_ms); 205 | break; 206 | case 0: 207 | led_set(0, 0); 208 | return s; 209 | } 210 | } 211 | } 212 | 213 | void doBetweenAuto(AutoSampleSettings* s){ 214 | uint8_t fpsChangeButton = (s->mouseBtn == MOUSE4) ? MOUSE5 : MOUSE4; 215 | pin_init(fpsChangeButton, B_write); 216 | 217 | _delay_ms(150); 218 | DDRD |= (1 << fpsChangeButton); 219 | _delay_ms(50); 220 | DDRD &= ~(1 << fpsChangeButton); 221 | _delay_ms(3600); 222 | } 223 | 224 | void doSampleAuto(AutoSampleSettings* s){ 225 | adc_init_freerun(s->adcChan & 0x03); 226 | pin_init(s->mouseBtn, B_write); 227 | 228 | TCCR3B = 3; 229 | 230 | for(uint16_t iter = 0; iter < s->samples; iter++){ 231 | // wait 232 | while(adc_read_freerun() > diodeThresh){} 233 | for(uint16_t i = 0; i < s->delay_ms; i++){ 234 | _delay_ms(1); 235 | } 236 | uint16_t r = rand(); 237 | for(uint16_t d = 0; d < r; d++){ 238 | _delay_us(1); 239 | } 240 | 241 | // sample 242 | DDRD |= (1 << s->mouseBtn); 243 | TCNT3 = 0; 244 | while(adc_read_freerun() < diodeThresh){} 245 | uint16_t t = TCNT3; 246 | DDRD &= ~(1 << s->mouseBtn); 247 | 248 | if(t*timerPrescalerToResolutionMs(TCCR3B) < 5.0){ 249 | iter--; 250 | continue; 251 | } 252 | 253 | // print 254 | uart_printf("%s%.3f", iter ? ", " : "", t*timerPrescalerToResolutionMs(TCCR3B)); 255 | } 256 | } 257 | 258 | void doSampleFPSRangeAuto(AutoSampleSettings s, uint16_t* fpsRange, uint8_t fpsRangeSize){ 259 | doSampleFPSRange(&s, fpsRange, fpsRangeSize, (void(*)(void*))&doBetweenAuto, (void(*)(void*))&doSampleAuto); 260 | } -------------------------------------------------------------------------------- /code/ResponseTimeTester/ResponseTimeTester/sample.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "pinconfig.h" 6 | 7 | 8 | void doMakeFPSRange(uint16_t* fpsRange, uint8_t fpsRangeSize, uint8_t* idxLow, uint8_t* idxLen); 9 | 10 | typedef struct AutoSampleSettings AutoSampleSettings; 11 | struct AutoSampleSettings { 12 | uint8_t mouseBtn; 13 | uint8_t adcChan; 14 | uint16_t samples; 15 | uint16_t delay_ms; 16 | }; 17 | 18 | AutoSampleSettings doMakeAutoSampleSettings(); 19 | void doSampleAuto(AutoSampleSettings* s); 20 | void doSampleFPSRangeAuto(AutoSampleSettings s, uint16_t* fpsRange, uint8_t fpsRangeSize); 21 | 22 | typedef enum ManualClickType ManualClickType; 23 | enum ManualClickType { 24 | MCT_keyboard = 0, 25 | MCT_mouse4 = MOUSE4, 26 | MCT_mouse5 = MOUSE5, 27 | }; 28 | 29 | typedef struct ManualSampleSettings ManualSampleSettings; 30 | struct ManualSampleSettings { 31 | ManualClickType clickType; 32 | uint8_t adcChan; 33 | uint8_t samples; 34 | uint16_t delay_ms; 35 | }; 36 | 37 | ManualSampleSettings doMakeManualSampleSettings(); 38 | void doSampleManual(ManualSampleSettings* s); 39 | void doSampleFPSRangeManual(ManualSampleSettings s, uint16_t* fpsRange, uint8_t fpsRangeSize); -------------------------------------------------------------------------------- /code/matlab/colors/kb_bcg.m: -------------------------------------------------------------------------------- 1 | function colors = kb_bcg(ncolors) 2 | 3 | cm = [ 4 | 0.10292257 0.28253360 0.47327729 5 | 0.10342763 0.28559479 0.47191630 6 | 0.10403905 0.28859873 0.47073636 7 | 0.10469657 0.29157167 0.46964121 8 | 0.10537824 0.29452290 0.46859878 9 | 0.10608156 0.29745353 0.46760886 10 | 0.10681039 0.30036218 0.46668124 11 | 0.10755099 0.30325429 0.46579763 12 | 0.10830466 0.30612936 0.46496364 13 | 0.10906764 0.30898884 0.46417683 14 | 0.10983226 0.31183552 0.46342887 15 | 0.11060063 0.31466858 0.46272622 16 | 0.11137175 0.31748841 0.46207032 17 | 0.11213584 0.32029836 0.46144995 18 | 0.11289536 0.32309752 0.46087159 19 | 0.11364498 0.32588765 0.46033046 20 | 0.11438651 0.32866813 0.45983161 21 | 0.11510698 0.33144303 0.45936030 22 | 0.11581447 0.33420973 0.45892970 23 | 0.11650430 0.33696968 0.45853587 24 | 0.11716512 0.33972617 0.45816710 25 | 0.11780375 0.34247709 0.45783403 26 | 0.11841617 0.34522358 0.45753376 27 | 0.11899870 0.34796661 0.45726397 28 | 0.11954987 0.35070652 0.45702479 29 | 0.12006183 0.35344532 0.45680965 30 | 0.12053626 0.35618244 0.45662221 31 | 0.12096962 0.35891871 0.45646055 32 | 0.12136131 0.36165418 0.45632559 33 | 0.12170716 0.36438978 0.45621481 34 | 0.12200353 0.36712625 0.45612635 35 | 0.12225010 0.36986355 0.45606134 36 | 0.12244278 0.37260248 0.45601751 37 | 0.12257890 0.37534350 0.45599395 38 | 0.12267485 0.37808458 0.45599174 39 | 0.12275919 0.38082350 0.45600289 40 | 0.12282379 0.38356204 0.45602098 41 | 0.12286752 0.38630051 0.45604511 42 | 0.12288917 0.38903921 0.45607428 43 | 0.12288812 0.39177832 0.45610788 44 | 0.12286324 0.39451812 0.45614490 45 | 0.12281383 0.39725882 0.45618458 46 | 0.12273888 0.40000065 0.45622592 47 | 0.12263747 0.40274386 0.45626791 48 | 0.12250979 0.40548853 0.45630970 49 | 0.12235443 0.40823490 0.45635053 50 | 0.12217070 0.41098314 0.45638952 51 | 0.12195798 0.41373343 0.45642572 52 | 0.12171545 0.41648595 0.45645801 53 | 0.12144300 0.41924079 0.45648567 54 | 0.12114050 0.42199802 0.45650794 55 | 0.12080750 0.42475777 0.45652379 56 | 0.12044348 0.42752019 0.45653214 57 | 0.12004906 0.43028527 0.45653223 58 | 0.11962496 0.43305298 0.45652332 59 | 0.11917022 0.43582351 0.45650434 60 | 0.11868489 0.43859690 0.45647431 61 | 0.11816955 0.44137314 0.45643256 62 | 0.11762472 0.44415223 0.45637831 63 | 0.11705010 0.44693427 0.45631026 64 | 0.11644691 0.44971918 0.45622792 65 | 0.11581588 0.45250693 0.45613048 66 | 0.11515722 0.45529759 0.45601677 67 | 0.11447231 0.45809104 0.45588621 68 | 0.11376237 0.46088723 0.45573807 69 | 0.11302790 0.46368619 0.45557117 70 | 0.11227084 0.46648778 0.45538502 71 | 0.11149273 0.46929192 0.45517889 72 | 0.11069450 0.47209862 0.45495159 73 | 0.10987887 0.47490768 0.45470286 74 | 0.10904720 0.47771907 0.45443161 75 | 0.10820188 0.48053267 0.45413721 76 | 0.10734556 0.48334831 0.45381910 77 | 0.10648074 0.48616593 0.45347615 78 | 0.10561847 0.48898476 0.45310808 79 | 0.10475370 0.49180529 0.45271396 80 | 0.10388998 0.49462734 0.45229327 81 | 0.10303080 0.49745076 0.45184537 82 | 0.10217961 0.50027542 0.45136948 83 | 0.10134088 0.50310112 0.45086523 84 | 0.10051815 0.50592775 0.45033165 85 | 0.09971671 0.50875507 0.44976859 86 | 0.09894037 0.51158299 0.44917497 87 | 0.09819526 0.51441121 0.44855077 88 | 0.09749946 0.51723878 0.44789492 89 | 0.09684617 0.52006627 0.44720743 90 | 0.09624010 0.52289359 0.44648723 91 | 0.09568801 0.52572043 0.44573433 92 | 0.09519515 0.52854670 0.44494777 93 | 0.09476835 0.53137210 0.44412747 94 | 0.09441340 0.53419650 0.44327267 95 | 0.09414015 0.53701946 0.44238313 96 | 0.09396739 0.53984006 0.44145846 97 | 0.09388638 0.54265897 0.44049808 98 | 0.09390357 0.54547597 0.43950174 99 | 0.09394420 0.54829534 0.43846959 100 | 0.09392484 0.55112147 0.43740570 101 | 0.09384869 0.55395406 0.43631053 102 | 0.09371579 0.55679317 0.43518242 103 | 0.09352769 0.55963867 0.43402080 104 | 0.09328616 0.56249043 0.43282528 105 | 0.09299332 0.56534824 0.43159577 106 | 0.09264986 0.56821207 0.43033122 107 | 0.09225759 0.57108175 0.42903140 108 | 0.09181726 0.57395723 0.42769541 109 | 0.09133054 0.57683835 0.42632297 110 | 0.09079809 0.57972505 0.42491319 111 | 0.09022017 0.58261732 0.42346493 112 | 0.08959863 0.58551497 0.42197813 113 | 0.08893537 0.58841783 0.42045276 114 | 0.08823050 0.59132589 0.41888764 115 | 0.08748607 0.59423894 0.41728288 116 | 0.08670215 0.59715699 0.41563734 117 | 0.08588031 0.60007987 0.41395082 118 | 0.08502129 0.60300753 0.41222263 119 | 0.08412581 0.60593988 0.41045205 120 | 0.08319550 0.60887679 0.40863894 121 | 0.08223019 0.61181825 0.40678205 122 | 0.08123093 0.61476418 0.40488089 123 | 0.08019870 0.61771447 0.40293491 124 | 0.07913481 0.62066902 0.40094374 125 | 0.07804046 0.62362772 0.39890695 126 | 0.07691585 0.62659055 0.39682347 127 | 0.07576251 0.62955740 0.39469303 128 | 0.07458118 0.63252820 0.39251486 129 | 0.07337218 0.63550294 0.39028790 130 | 0.07213757 0.63848145 0.38801211 131 | 0.07087741 0.64146374 0.38568622 132 | 0.06959250 0.64444976 0.38330938 133 | 0.06828491 0.64743937 0.38088140 134 | 0.06695469 0.65043258 0.37840089 135 | 0.06560281 0.65342935 0.37586696 136 | 0.06423119 0.65642956 0.37327916 137 | 0.06284052 0.65943319 0.37063627 138 | 0.06143144 0.66244023 0.36793703 139 | 0.06000605 0.66545057 0.36518085 140 | 0.05856546 0.66846418 0.36236653 141 | 0.05711080 0.67148103 0.35949278 142 | 0.05564306 0.67450112 0.35655813 143 | 0.05416553 0.67752429 0.35356223 144 | 0.05267832 0.68055060 0.35050289 145 | 0.05118359 0.68358000 0.34737888 146 | 0.04968297 0.68661246 0.34418854 147 | 0.04817997 0.68964787 0.34093103 148 | 0.04667538 0.69268629 0.33760389 149 | 0.04517189 0.69572765 0.33420547 150 | 0.04367195 0.69877194 0.33073377 151 | 0.04217957 0.70181908 0.32718734 152 | 0.04069689 0.70486908 0.32356354 153 | 0.03921720 0.70792194 0.31985989 154 | 0.03778115 0.71097760 0.31607407 155 | 0.03639573 0.71403605 0.31220332 156 | 0.03506449 0.71709723 0.30824533 157 | 0.03378837 0.72016117 0.30419626 158 | 0.03257035 0.72322784 0.30005303 159 | 0.03139831 0.72629782 0.29580401 160 | 0.03084884 0.72935859 0.29146310 161 | 0.03099311 0.73240963 0.28700711 162 | 0.03188821 0.73544990 0.28243485 163 | 0.03358958 0.73847847 0.27774229 164 | 0.03615368 0.74149464 0.27291892 165 | 0.03970398 0.74449577 0.26797069 166 | 0.04410002 0.74748197 0.26288454 167 | 0.04917476 0.75045225 0.25765039 168 | 0.05486481 0.75340527 0.25226264 169 | 0.06110071 0.75633979 0.24671157 170 | 0.06782087 0.75925459 0.24098254 171 | 0.07500565 0.76214681 0.23507702 172 | 0.08267605 0.76501213 0.22899730 173 | 0.09069976 0.76785223 0.22270727 174 | 0.09905103 0.77066527 0.21618786 175 | 0.10781679 0.77344374 0.20946073 176 | 0.11690644 0.77618836 0.20248558 177 | 0.12630611 0.77889673 0.19523255 178 | 0.13609894 0.78156011 0.18772776 179 | 0.14617596 0.78418105 0.17990106 180 | 0.15665586 0.78674797 0.17177906 181 | 0.16745867 0.78926135 0.16330374 182 | 0.17862106 0.79171410 0.15445133 183 | 0.19018952 0.79409674 0.14524080 184 | 0.20212147 0.79640680 0.13560774 185 | 0.21443175 0.79863666 0.12553934 186 | 0.22712356 0.80077892 0.11503007 187 | 0.24019239 0.80282645 0.10407642 188 | 0.25360947 0.80477389 0.09270186 189 | 0.26733700 0.80661715 0.08093942 190 | 0.28131211 0.80835524 0.06886298 191 | 0.29545830 0.80999009 0.05658755 192 | 0.30968499 0.81152716 0.04429940 193 | 0.32389417 0.81297533 0.03265003 194 | 0.33799170 0.81434583 0.02346736 195 | 0.35190187 0.81565000 0.01699052 196 | 0.36554803 0.81690213 0.01314299 197 | 0.37887584 0.81811547 0.01179557 198 | 0.39185418 0.81930109 0.01280792 199 | 0.40446803 0.82046830 0.01601782 200 | 0.41674638 0.82162132 0.02096198 201 | 0.42867205 0.82277669 0.02638448 202 | 0.44028616 0.82393253 0.03232070 203 | 0.45161197 0.82508922 0.03881229 204 | 0.46267289 0.82624653 0.04561546 205 | 0.47348277 0.82740552 0.05236498 206 | 0.48406046 0.82856590 0.05910606 207 | 0.49441641 0.82972863 0.06586787 208 | 0.50456165 0.83089428 0.07267670 209 | 0.51450013 0.83206446 0.07956925 210 | 0.52424519 0.83323895 0.08654690 211 | 0.53380326 0.83441857 0.09362489 212 | 0.54317603 0.83560497 0.10082461 213 | 0.55235981 0.83680079 0.10817440 214 | 0.56136655 0.83800549 0.11566230 215 | 0.57018344 0.83922348 0.12332906 216 | 0.57882020 0.84045456 0.13115957 217 | 0.58725968 0.84170414 0.13919239 218 | 0.59550802 0.84297282 0.14741217 219 | 0.60355333 0.84426502 0.15583771 220 | 0.61138458 0.84558517 0.16448009 221 | 0.61899751 0.84693630 0.17333171 222 | 0.62638100 0.84832311 0.18239417 223 | 0.63352458 0.84975022 0.19166589 224 | 0.64041699 0.85122265 0.20113948 225 | 0.64704882 0.85274502 0.21080473 226 | 0.65341113 0.85432204 0.22064533 227 | 0.65961806 0.85592992 0.23042320 228 | 0.66573058 0.85755567 0.24004334 229 | 0.67175089 0.85919944 0.24952596 230 | 0.67768100 0.86086141 0.25888821 231 | 0.68352291 0.86254171 0.26814470 232 | 0.68927857 0.86424048 0.27730795 233 | 0.69494984 0.86595783 0.28638867 234 | 0.70053860 0.86769386 0.29539627 235 | 0.70604662 0.86944865 0.30433874 236 | 0.71147571 0.87122226 0.31322323 237 | 0.71682760 0.87301474 0.32205583 238 | 0.72210401 0.87482612 0.33084197 239 | 0.72730666 0.87665642 0.33958641 240 | 0.73243719 0.87850564 0.34829324 241 | 0.73749730 0.88037376 0.35696618 242 | 0.74248862 0.88226075 0.36560844 243 | 0.74741203 0.88416675 0.37422400 244 | 0.75226980 0.88609153 0.38281439 245 | 0.75706352 0.88803504 0.39138158 246 | 0.76179483 0.88999716 0.39992762 247 | 0.76646525 0.89197782 0.40845408 248 | 0.77108050 0.89397510 0.41697228 249 | 0.77568246 0.89597712 0.42545406 250 | 0.78028267 0.89798193 0.43386801 251 | 0.78488142 0.89998948 0.44221862 252 | 0.78948013 0.90199922 0.45051353 253 | 0.79407702 0.90401212 0.45874998 254 | 0.79867385 0.90602745 0.46693617 255 | 0.80327094 0.90804514 0.47507555 256 | 0.80786760 0.91006566 0.48316812 257 | 0.81246629 0.91208787 0.49122354 258 | 0.81707031 0.91411019 0.49925369 259 | 0.82171245 0.91611594 0.50736038 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_bgry.m: -------------------------------------------------------------------------------- 1 | function colors = kb_bgry(ncolors) 2 | 3 | cm = [ 4 | 0.03973905 0.04040393 0.49860935 5 | 0.03259309 0.05934883 0.49000016 6 | 0.02679961 0.07378320 0.48230587 7 | 0.02197508 0.08579857 0.47510860 8 | 0.01803669 0.09616132 0.46838595 9 | 0.01488715 0.10533644 0.46207181 10 | 0.01246009 0.11360264 0.45613679 11 | 0.01069311 0.12115455 0.45054410 12 | 0.00953176 0.12813218 0.44525773 13 | 0.00893868 0.13462889 0.44027140 14 | 0.00887191 0.14072517 0.43555658 15 | 0.00929425 0.14648524 0.43108285 16 | 0.01018093 0.15195070 0.42685138 17 | 0.01150568 0.15715910 0.42285299 18 | 0.01323777 0.16215299 0.41903930 19 | 0.01536357 0.16694654 0.41544001 20 | 0.01785825 0.17157268 0.41200632 21 | 0.02070848 0.17604156 0.40876105 22 | 0.02389597 0.18037718 0.40566420 23 | 0.02740803 0.18458877 0.40272622 24 | 0.03123128 0.18868816 0.39994134 25 | 0.03535408 0.19268959 0.39728553 26 | 0.03976579 0.19660060 0.39475960 27 | 0.04428052 0.20042828 0.39236303 28 | 0.04875329 0.20418023 0.39008872 29 | 0.05318653 0.20786348 0.38792846 30 | 0.05757687 0.21148446 0.38587352 31 | 0.06192199 0.21504838 0.38391870 32 | 0.06621971 0.21855908 0.38206466 33 | 0.07046923 0.22202082 0.38030722 34 | 0.07467038 0.22543761 0.37864162 35 | 0.07882325 0.22881296 0.37706419 36 | 0.08305027 0.23213414 0.37556164 37 | 0.08751614 0.23538633 0.37408153 38 | 0.09220208 0.23857107 0.37262195 39 | 0.09708869 0.24168932 0.37118584 40 | 0.10215680 0.24474206 0.36977664 41 | 0.10738768 0.24773042 0.36839813 42 | 0.11276300 0.25065560 0.36705452 43 | 0.11826485 0.25351901 0.36575045 44 | 0.12387602 0.25632222 0.36449047 45 | 0.12958291 0.25906648 0.36327895 46 | 0.13537871 0.26175204 0.36211975 47 | 0.14123492 0.26438344 0.36101825 48 | 0.14713744 0.26696305 0.35997839 49 | 0.15307322 0.26949340 0.35900375 50 | 0.15903025 0.27197712 0.35809745 51 | 0.16499759 0.27441693 0.35726214 52 | 0.17096531 0.27681562 0.35650002 53 | 0.17692485 0.27917595 0.35581246 54 | 0.18286855 0.28150070 0.35520049 55 | 0.18878973 0.28379260 0.35466463 56 | 0.19468218 0.28605438 0.35420543 57 | 0.20054115 0.28828863 0.35382244 58 | 0.20636270 0.29049783 0.35351484 59 | 0.21214347 0.29268437 0.35328164 60 | 0.21788024 0.29485061 0.35312208 61 | 0.22357046 0.29699880 0.35303504 62 | 0.22921316 0.29913086 0.35301829 63 | 0.23480527 0.30124906 0.35307173 64 | 0.24035781 0.30335192 0.35319126 65 | 0.24586089 0.30544358 0.35337742 66 | 0.25131246 0.30752619 0.35362790 67 | 0.25671195 0.30960139 0.35394115 68 | 0.26205774 0.31167098 0.35431674 69 | 0.26735056 0.31373621 0.35475231 70 | 0.27259879 0.31579572 0.35524569 71 | 0.27780335 0.31785037 0.35579562 72 | 0.28295465 0.31990444 0.35640178 73 | 0.28805265 0.32195916 0.35706310 74 | 0.29309737 0.32401566 0.35777864 75 | 0.29810833 0.32606829 0.35854630 76 | 0.30306632 0.32812458 0.35936694 77 | 0.30797107 0.33018563 0.36024019 78 | 0.31282734 0.33225067 0.36116568 79 | 0.31764658 0.33431630 0.36214340 80 | 0.32241220 0.33638923 0.36317523 81 | 0.32712550 0.33846977 0.36426155 82 | 0.33180563 0.34055126 0.36540406 83 | 0.33643698 0.34263995 0.36660582 84 | 0.34101998 0.34473619 0.36786890 85 | 0.34557548 0.34683204 0.36919771 86 | 0.35009415 0.34893123 0.37059624 87 | 0.35458112 0.35103203 0.37206687 88 | 0.35906667 0.35312197 0.37361705 89 | 0.36354695 0.35520307 0.37524461 90 | 0.36804420 0.35726652 0.37694946 91 | 0.37259309 0.35929857 0.37872754 92 | 0.37719885 0.36129847 0.38056316 93 | 0.38190129 0.36325069 0.38244301 94 | 0.38670991 0.36515308 0.38434295 95 | 0.39163140 0.36700438 0.38623971 96 | 0.39668883 0.36879553 0.38811569 97 | 0.40185405 0.37053971 0.38994884 98 | 0.40714670 0.37222796 0.39173181 99 | 0.41253364 0.37387451 0.39345498 100 | 0.41801509 0.37547834 0.39511684 101 | 0.42358130 0.37704267 0.39671785 102 | 0.42921063 0.37857617 0.39825964 103 | 0.43491653 0.38007134 0.39974742 104 | 0.44065980 0.38154523 0.40118368 105 | 0.44647508 0.38298045 0.40257461 106 | 0.45231535 0.38439828 0.40392235 107 | 0.45821432 0.38578168 0.40523208 108 | 0.46413594 0.38714725 0.40650631 109 | 0.47010537 0.38848198 0.40774881 110 | 0.47609698 0.38979783 0.40896190 111 | 0.48212899 0.39108513 0.41014832 112 | 0.48818281 0.39235271 0.41131000 113 | 0.49427244 0.39359292 0.41244894 114 | 0.50038302 0.39481297 0.41356673 115 | 0.50652719 0.39600585 0.41466482 116 | 0.51269067 0.39717867 0.41574449 117 | 0.51888754 0.39832357 0.41680677 118 | 0.52510107 0.39944919 0.41785276 119 | 0.53135022 0.40054491 0.41888283 120 | 0.53762789 0.40161676 0.41987463 121 | 0.54390828 0.40267974 0.42082185 122 | 0.55023377 0.40371006 0.42172193 123 | 0.55655931 0.40473303 0.42257598 124 | 0.56292909 0.40572336 0.42338086 125 | 0.56930055 0.40670549 0.42413760 126 | 0.57571123 0.40765750 0.42484305 127 | 0.58212958 0.40859786 0.42549766 128 | 0.58857803 0.40951326 0.42609850 129 | 0.59504584 0.41041008 0.42664450 130 | 0.60152881 0.41129085 0.42713475 131 | 0.60804654 0.41214346 0.42756633 132 | 0.61455912 0.41299274 0.42794024 133 | 0.62112124 0.41380444 0.42825050 134 | 0.62766914 0.41461911 0.42849847 135 | 0.63425493 0.41540347 0.42867970 136 | 0.64085560 0.41617232 0.42879329 137 | 0.64746119 0.41693264 0.42883591 138 | 0.65410470 0.41766241 0.42880458 139 | 0.66073928 0.41839347 0.42869707 140 | 0.66739296 0.41910697 0.42851131 141 | 0.67408106 0.41979287 0.42823914 142 | 0.68074661 0.42049046 0.42788503 143 | 0.68743167 0.42117122 0.42744079 144 | 0.69414135 0.42183197 0.42689972 145 | 0.70083959 0.42249853 0.42626302 146 | 0.70753406 0.42316627 0.42552509 147 | 0.71424002 0.42382483 0.42467918 148 | 0.72095214 0.42447862 0.42372049 149 | 0.72764381 0.42514813 0.42264665 150 | 0.73431530 0.42583433 0.42145218 151 | 0.74097643 0.42653089 0.42013033 152 | 0.74762121 0.42724360 0.41867384 153 | 0.75423979 0.42798101 0.41707932 154 | 0.76082308 0.42875152 0.41534167 155 | 0.76736079 0.42956459 0.41345649 156 | 0.77384169 0.43043064 0.41141993 157 | 0.78024859 0.43136481 0.40923142 158 | 0.78657493 0.43237407 0.40688881 159 | 0.79280740 0.43347063 0.40439331 160 | 0.79892295 0.43467453 0.40175061 161 | 0.80490573 0.43599990 0.39896890 162 | 0.81073950 0.43746084 0.39606051 163 | 0.81640715 0.43907188 0.39304196 164 | 0.82189269 0.44084622 0.38993332 165 | 0.82718118 0.44279552 0.38676076 166 | 0.83226093 0.44492840 0.38355142 167 | 0.83712350 0.44725030 0.38033425 168 | 0.84176445 0.44976307 0.37713731 169 | 0.84618081 0.45246697 0.37398828 170 | 0.85036359 0.45536735 0.37091151 171 | 0.85433743 0.45844144 0.36792261 172 | 0.85811184 0.46167919 0.36503621 173 | 0.86169806 0.46506929 0.36226296 174 | 0.86510841 0.46859968 0.35960976 175 | 0.86835568 0.47225832 0.35707907 176 | 0.87145262 0.47603336 0.35467099 177 | 0.87441158 0.47991353 0.35238331 178 | 0.87724504 0.48388740 0.35021578 179 | 0.87994343 0.48796187 0.34816552 180 | 0.88253221 0.49211521 0.3462286 181 | 0.88502323 0.49633748 0.34439682 182 | 0.88742620 0.50062030 0.34266577 183 | 0.88975025 0.50495593 0.34103093 184 | 0.89199805 0.50934182 0.33948874 185 | 0.89414297 0.51379802 0.33804017 186 | 0.89622932 0.51828975 0.33667436 187 | 0.89826386 0.52281176 0.33538609 188 | 0.90023434 0.52737316 0.33417403 189 | 0.90212513 0.53198521 0.33303785 190 | 0.90397894 0.53661577 0.33196642 191 | 0.90579227 0.54126726 0.33096028 192 | 0.90752221 0.54597110 0.33002158 193 | 0.90922893 0.55068294 0.32913941 194 | 0.91089201 0.55541780 0.32831278 195 | 0.91249100 0.56018984 0.32754650 196 | 0.91407598 0.56496363 0.32682538 197 | 0.91559620 0.56977462 0.32616143 198 | 0.91708761 0.57459763 0.32554321 199 | 0.91855142 0.57943191 0.32496865 200 | 0.91995504 0.58429961 0.32444432 201 | 0.92136065 0.58915835 0.32395649 202 | 0.92267986 0.59406841 0.32351061 203 | 0.92398807 0.59898182 0.32304180 204 | 0.92529684 0.60389006 0.32256575 205 | 0.92659417 0.60880241 0.32206620 206 | 0.92788222 0.61371742 0.32154602 207 | 0.92916888 0.61862950 0.32101595 208 | 0.93043639 0.62355184 0.32045146 209 | 0.93171081 0.62846567 0.31988831 210 | 0.93296711 0.63338935 0.31929167 211 | 0.93421829 0.63831366 0.31867929 212 | 0.93546332 0.64323957 0.31804944 213 | 0.93669042 0.64817551 0.31738521 214 | 0.93792269 0.65310551 0.31671867 215 | 0.93913915 0.65804440 0.31601978 216 | 0.94034285 0.66299014 0.31529223 217 | 0.94154884 0.66793265 0.31455694 218 | 0.94273722 0.67288564 0.31378483 219 | 0.94391700 0.67784314 0.31298806 220 | 0.94509466 0.68280103 0.31217535 221 | 0.94625629 0.68776871 0.31132570 222 | 0.94740729 0.69274271 0.31044604 223 | 0.94855840 0.69771621 0.30955138 224 | 0.94969408 0.70269949 0.30861786 225 | 0.95081465 0.70769241 0.30764482 226 | 0.95193741 0.71268407 0.30665717 227 | 0.95304798 0.71768383 0.30563232 228 | 0.95414397 0.72269328 0.30456547 229 | 0.95522607 0.72771208 0.30345635 230 | 0.95631010 0.73273054 0.30232814 231 | 0.95738186 0.73775766 0.30115781 232 | 0.95843977 0.74279449 0.29994153 233 | 0.95948472 0.74784058 0.29867924 234 | 0.96051714 0.75289575 0.29737016 235 | 0.96154647 0.75795447 0.29602798 236 | 0.96256477 0.76302165 0.29463866 237 | 0.96357098 0.76809801 0.29319895 238 | 0.96456438 0.77318408 0.29170603 239 | 0.96554627 0.77827916 0.29016040 240 | 0.96651494 0.78338437 0.28855749 241 | 0.96747169 0.78849900 0.28689773 242 | 0.96841615 0.79362338 0.28517868 243 | 0.96934784 0.79875785 0.28339763 244 | 0.97026625 0.80390277 0.28155171 245 | 0.97117003 0.80905896 0.27963652 246 | 0.97205693 0.81422773 0.27764575 247 | 0.97292631 0.81940945 0.27557581 248 | 0.97379158 0.82459680 0.27344882 249 | 0.97463884 0.82979749 0.27123707 250 | 0.97546026 0.83501577 0.26892292 251 | 0.97627489 0.84024135 0.26653926 252 | 0.97706289 0.84548492 0.26404531 253 | 0.97784024 0.85073795 0.26146849 254 | 0.97858951 0.85600968 0.25877107 255 | 0.97931714 0.86129666 0.25596146 256 | 0.98002113 0.86659989 0.25303117 257 | 0.98068889 0.87192582 0.24994897 258 | 0.98131485 0.87727712 0.24669643 259 | 0.98175331 0.88272769 0.24295029 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_bgy_dark.m: -------------------------------------------------------------------------------- 1 | function colors = kb_bgy_dark(ncolors) 2 | 3 | cm = [ 4 | 0.23792204 0.12997432 0.28282052 5 | 0.23808826 0.13425807 0.28648681 6 | 0.23833267 0.13842451 0.29011920 7 | 0.23857568 0.14253023 0.29374954 8 | 0.23880731 0.14658493 0.29738394 9 | 0.23902685 0.15059204 0.30102495 10 | 0.23923211 0.15455547 0.30467567 11 | 0.23941764 0.15848043 0.30834042 12 | 0.23958238 0.16236938 0.31202180 13 | 0.23972817 0.16622306 0.31572116 14 | 0.23985841 0.17004141 0.31943906 15 | 0.23996972 0.17382765 0.32317865 16 | 0.24005382 0.17758703 0.32694514 17 | 0.24012020 0.18131621 0.33073603 18 | 0.24015820 0.18502117 0.33455737 19 | 0.24016927 0.18870208 0.33840979 20 | 0.24015728 0.19235821 0.34229256 21 | 0.24011077 0.19599511 0.34621184 22 | 0.24002985 0.19961330 0.35016839 23 | 0.23991677 0.20321244 0.35416159 24 | 0.23976723 0.20679479 0.35819385 25 | 0.23957872 0.21036171 0.36226647 26 | 0.23934697 0.21391516 0.36638155 27 | 0.23906702 0.21745717 0.37054138 28 | 0.23873669 0.22098866 0.37474668 29 | 0.23835414 0.22451042 0.37899773 30 | 0.23791576 0.22802373 0.38329558 31 | 0.23741781 0.23152987 0.38764122 32 | 0.23685665 0.23502994 0.39203536 33 | 0.23622863 0.23852500 0.39647858 34 | 0.23552916 0.24201628 0.40097179 35 | 0.23475094 0.24550565 0.40551731 36 | 0.23389012 0.24899389 0.41011531 37 | 0.23294324 0.25248157 0.41476554 38 | 0.23190581 0.25596949 0.41946817 39 | 0.23077244 0.25945857 0.42422368 40 | 0.22953864 0.26294942 0.42903182 41 | 0.22819777 0.26644305 0.43389337 42 | 0.22674468 0.26994000 0.43880804 43 | 0.22516111 0.27344364 0.44378262 44 | 0.22347702 0.27697160 0.44864918 45 | 0.22164504 0.28053245 0.45343518 46 | 0.21966003 0.28412784 0.45812710 47 | 0.21752365 0.28775789 0.46270793 48 | 0.21523312 0.29142371 0.46716234 49 | 0.21279220 0.29512490 0.47147252 50 | 0.21020241 0.29886157 0.47562174 51 | 0.20747045 0.30263262 0.47959225 52 | 0.20460556 0.30643644 0.48336681 53 | 0.20161968 0.31027077 0.48692906 54 | 0.19852854 0.31413260 0.49026388 55 | 0.19535155 0.31801815 0.49335805 56 | 0.19211248 0.32192278 0.49620082 57 | 0.18883858 0.32584121 0.49878452 58 | 0.18556005 0.32976771 0.50110498 59 | 0.18230932 0.33369623 0.50316179 60 | 0.17912008 0.33762064 0.50495838 61 | 0.17602612 0.34153497 0.50650182 62 | 0.17306019 0.34543363 0.50780252 63 | 0.17025283 0.34931158 0.50887363 64 | 0.16763143 0.35316448 0.50973050 65 | 0.16521968 0.35698874 0.51039005 66 | 0.16303665 0.36078160 0.51087000 67 | 0.16109635 0.36454121 0.51118815 68 | 0.15940832 0.36826641 0.51136210 69 | 0.15798013 0.37195609 0.51141048 70 | 0.15681061 0.37561077 0.51134842 71 | 0.15589900 0.37923046 0.51119275 72 | 0.15527140 0.38281505 0.51093141 73 | 0.15490617 0.38636550 0.51059317 74 | 0.15477919 0.38988407 0.51019752 75 | 0.15487755 0.39337217 0.50975636 76 | 0.15518671 0.39683139 0.50928053 77 | 0.15570315 0.40026284 0.50877170 78 | 0.15646808 0.40366550 0.50819974 79 | 0.15739967 0.40704419 0.50761721 80 | 0.15848029 0.41040080 0.50703125 81 | 0.15971592 0.41373603 0.50643262 82 | 0.16114329 0.41704886 0.50579178 83 | 0.16267212 0.42034486 0.50516256 84 | 0.16428725 0.42362548 0.50455136 85 | 0.16607849 0.42688681 0.50389187 86 | 0.16793239 0.43013597 0.50325164 87 | 0.16983446 0.43337425 0.50263760 88 | 0.17188205 0.43659721 0.50197646 89 | 0.17395085 0.43981228 0.50134835 90 | 0.17606938 0.44301900 0.50072515 91 | 0.17826855 0.44621581 0.50008401 92 | 0.18045774 0.44940907 0.49947874 93 | 0.18272883 0.45259377 0.49884286 94 | 0.18499684 0.45577568 0.49822981 95 | 0.18728330 0.45895415 0.49762006 96 | 0.18960180 0.46212897 0.49699888 97 | 0.19188919 0.46530485 0.49640535 98 | 0.19423400 0.46847647 0.49577460 99 | 0.19652193 0.47165186 0.49518318 100 | 0.19886239 0.47482430 0.49454971 101 | 0.20114788 0.47800157 0.49394639 102 | 0.20346046 0.48117860 0.49331098 103 | 0.20572865 0.48436070 0.49269210 104 | 0.20800757 0.48754457 0.49204597 105 | 0.21024674 0.49073408 0.49140732 106 | 0.21248808 0.49392676 0.49074136 107 | 0.21468934 0.49712589 0.49007799 108 | 0.21689089 0.50032908 0.48938281 109 | 0.21904799 0.50353968 0.48868921 110 | 0.22120935 0.50675468 0.48795586 111 | 0.22331880 0.50997809 0.48722753 112 | 0.22544103 0.51320597 0.48644656 113 | 0.22750088 0.51644347 0.48567642 114 | 0.22958629 0.51968509 0.48483785 115 | 0.23160872 0.52293674 0.48400865 116 | 0.23364947 0.52619320 0.48311523 117 | 0.23564396 0.52945882 0.48221535 118 | 0.23763773 0.53273096 0.48126392 119 | 0.23960872 0.53601105 0.48028152 120 | 0.24156037 0.53929862 0.47926821 121 | 0.24351500 0.54259269 0.47819726 122 | 0.24542920 0.54589580 0.47711411 123 | 0.24737424 0.54920368 0.47594482 124 | 0.24928102 0.55252024 0.47476404 125 | 0.25120113 0.55584281 0.47351253 126 | 0.25311178 0.55917214 0.47222139 127 | 0.25501161 0.56250849 0.47088993 128 | 0.25693399 0.56585009 0.46947860 129 | 0.25883346 0.56919875 0.46804820 130 | 0.26076458 0.57255214 0.46652598 131 | 0.26269042 0.57591139 0.46496625 132 | 0.26462042 0.57927629 0.46335364 133 | 0.26658125 0.58264521 0.46165694 134 | 0.26853256 0.58601990 0.45993122 135 | 0.27052272 0.58939799 0.45811171 136 | 0.27252305 0.59278053 0.45624052 137 | 0.27453105 0.59616746 0.45432278 138 | 0.27658872 0.59955675 0.45229971 139 | 0.27864432 0.60295278 0.45021693 140 | 0.28072958 0.60635021 0.44808016 141 | 0.28284295 0.60974971 0.44588266 142 | 0.28495222 0.61315994 0.44357265 143 | 0.28712989 0.61656238 0.44125035 144 | 0.28931242 0.61997386 0.43881682 145 | 0.29152894 0.62338690 0.43631224 146 | 0.29379456 0.62679809 0.43375068 147 | 0.29606781 0.63021821 0.43106743 148 | 0.29842076 0.63362880 0.42836700 149 | 0.30079014 0.63704661 0.42554599 150 | 0.30321207 0.64046219 0.42265886 151 | 0.30568584 0.64387624 0.41969504 152 | 0.30818800 0.64729494 0.41661353 153 | 0.31077428 0.65070337 0.41350759 154 | 0.31338047 0.65411950 0.41025131 155 | 0.31607337 0.65752485 0.40696775 156 | 0.31880212 0.66093358 0.40355599 157 | 0.32160120 0.66433638 0.40007488 158 | 0.32445857 0.66773680 0.39649409 159 | 0.32737421 0.67113481 0.39281030 160 | 0.33036633 0.67452533 0.38905635 161 | 0.33340864 0.67791600 0.38516890 162 | 0.33654114 0.68129536 0.38123076 163 | 0.33972006 0.68467633 0.37713351 164 | 0.34299861 0.68804337 0.37299543 165 | 0.34632408 0.69141207 0.36868351 166 | 0.34975411 0.69476522 0.36433467 167 | 0.35323582 0.69811886 0.35980467 168 | 0.35682291 0.70145666 0.35522819 169 | 0.36047073 0.70479241 0.35047383 170 | 0.36422068 0.70811326 0.34564980 171 | 0.36804496 0.71142816 0.34066132 172 | 0.37196451 0.71473044 0.33556166 173 | 0.37597582 0.71802116 0.33033046 174 | 0.38007148 0.72130283 0.32492931 175 | 0.38428057 0.72456579 0.31944616 176 | 0.38856868 0.72782220 0.31372924 177 | 0.39298145 0.73105615 0.30794264 178 | 0.39748841 0.73427813 0.30195143 179 | 0.40210043 0.73748518 0.29575914 180 | 0.40684168 0.74066807 0.28946528 181 | 0.41168831 0.74383640 0.28291461 182 | 0.41665841 0.74698333 0.27617057 183 | 0.42176770 0.75010338 0.26927351 184 | 0.42700301 0.75320245 0.26209709 185 | 0.43237159 0.75627778 0.25464009 186 | 0.43790621 0.75931721 0.24703427 187 | 0.44359242 0.76232707 0.23912823 188 | 0.44944040 0.76530421 0.23090094 189 | 0.45546241 0.76824462 0.22233822 190 | 0.46167451 0.77114354 0.21341523 191 | 0.46809902 0.77399226 0.20419519 192 | 0.47474318 0.77678974 0.19456064 193 | 0.48162539 0.77952985 0.18447712 194 | 0.48877017 0.78220480 0.17390066 195 | 0.49620510 0.78480557 0.16278135 196 | 0.50395954 0.78732198 0.15106732 197 | 0.51207611 0.78973723 0.13885569 198 | 0.52058908 0.79203913 0.12606636 199 | 0.52953529 0.79421312 0.11264773 200 | 0.53895404 0.79623810 0.09890710 201 | 0.54886748 0.79809565 0.08535901 202 | 0.55924527 0.79977891 0.07288879 203 | 0.56997961 0.80130017 0.06294158 204 | 0.58089195 0.80268667 0.05809402 205 | 0.59172860 0.80400163 0.05938805 206 | 0.60227160 0.80530809 0.06627580 207 | 0.61239469 0.80664810 0.07738936 208 | 0.62205071 0.80805110 0.09067902 209 | 0.63125100 0.80952611 0.10504035 210 | 0.64003044 0.81107805 0.11955294 211 | 0.64844131 0.81269807 0.13410139 212 | 0.65652841 0.81438126 0.14846298 213 | 0.66432931 0.81612424 0.16247911 214 | 0.67187968 0.81792105 0.17615087 215 | 0.67921127 0.81976599 0.18949326 216 | 0.68634707 0.82165560 0.20251570 217 | 0.69331241 0.82358478 0.21524401 218 | 0.70012311 0.82555135 0.22768809 219 | 0.70679949 0.82754888 0.23994276 220 | 0.71336998 0.82956924 0.25204608 221 | 0.71991310 0.83159403 0.26383180 222 | 0.72643918 0.83362147 0.27530393 223 | 0.73294835 0.83565191 0.28649813 224 | 0.73944130 0.83768545 0.29744521 225 | 0.74591327 0.83972450 0.30815817 226 | 0.75236651 0.84176852 0.31866329 227 | 0.75880610 0.84381576 0.32898983 228 | 0.76523058 0.84586721 0.33914910 229 | 0.77164215 0.84792229 0.34915878 230 | 0.77803967 0.84998185 0.35902716 231 | 0.78442386 0.85204596 0.36876532 232 | 0.79079622 0.85411431 0.37838483 233 | 0.79715639 0.85618741 0.38789205 234 | 0.80350483 0.85826542 0.39729432 235 | 0.80984220 0.86034839 0.40659858 236 | 0.81616914 0.86243637 0.41581105 237 | 0.82248631 0.86452942 0.42493739 238 | 0.82879503 0.86662724 0.43398417 239 | 0.83509603 0.86872982 0.44295612 240 | 0.84138992 0.87083721 0.45185744 241 | 0.84767666 0.87294973 0.46069059 242 | 0.85395055 0.87507052 0.46944631 243 | 0.86022081 0.87719542 0.47814536 244 | 0.86648952 0.87932370 0.48679358 245 | 0.87275219 0.88145787 0.49538341 246 | 0.87900547 0.88359997 0.50390961 247 | 0.88526464 0.88574259 0.51240361 248 | 0.89151024 0.88789590 0.52082799 249 | 0.89776483 0.89004870 0.52922790 250 | 0.90400697 0.89221228 0.53756221 251 | 0.91025364 0.89437819 0.54586461 252 | 0.91650284 0.89654773 0.55413164 253 | 0.92275187 0.89872257 0.56235855 254 | 0.92900273 0.90090193 0.57054954 255 | 0.93526131 0.90308295 0.57871606 256 | 0.94152276 0.90526844 0.58684912 257 | 0.94779853 0.90745247 0.59497036 258 | 0.95409627 0.90963105 0.60309388 259 | 0.96050056 0.91175810 0.61137533 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_bgy_light.m: -------------------------------------------------------------------------------- 1 | function colors = kb_bgy_light(ncolors) 2 | 3 | cm = [ 4 | 0.37020277 0.26712855 0.93971518 5 | 0.36569056 0.27421638 0.93911122 6 | 0.36129179 0.28096445 0.93866063 7 | 0.35685793 0.28750359 0.93830149 8 | 0.35237117 0.29385975 0.93802696 9 | 0.34780126 0.30006265 0.93782707 10 | 0.34315230 0.30611776 0.93770437 11 | 0.33840798 0.31204145 0.93765485 12 | 0.33357619 0.31783510 0.93768208 13 | 0.32863339 0.32351609 0.93778053 14 | 0.32357088 0.32909215 0.93794954 15 | 0.31838593 0.33456724 0.93819008 16 | 0.31306766 0.33994851 0.93850112 17 | 0.30760697 0.34524134 0.93888230 18 | 0.30197599 0.35045780 0.93932972 19 | 0.29617474 0.35559732 0.93984564 20 | 0.29019534 0.36066227 0.94043055 21 | 0.28400624 0.36566272 0.94108118 22 | 0.27759340 0.37060099 0.94179782 23 | 0.27094553 0.37547785 0.94258127 24 | 0.26401920 0.38030307 0.94342832 25 | 0.25680619 0.38507410 0.94434094 26 | 0.24926329 0.38979754 0.94531719 27 | 0.24135106 0.39447677 0.94635647 28 | 0.23304395 0.39911004 0.94745990 29 | 0.22454955 0.40383775 0.94791888 30 | 0.21595386 0.40865276 0.94766916 31 | 0.20731636 0.41351835 0.94678937 32 | 0.19872135 0.41841861 0.94527478 33 | 0.19023057 0.42332634 0.94319245 34 | 0.18187572 0.42820866 0.94066350 35 | 0.17370378 0.43304912 0.93774401 36 | 0.16576065 0.43783392 0.93448851 37 | 0.15808385 0.44255353 0.93094531 38 | 0.15071685 0.44720197 0.92714980 39 | 0.14369479 0.45177320 0.92314627 40 | 0.13703838 0.45626082 0.91899076 41 | 0.13077871 0.46066325 0.91471494 42 | 0.12494533 0.46498014 0.91034649 43 | 0.11959526 0.46921562 0.90588136 44 | 0.11474711 0.47336678 0.90136440 45 | 0.11041989 0.47743637 0.89681222 46 | 0.10664167 0.48142464 0.89224819 47 | 0.10342418 0.48533490 0.88768444 48 | 0.10077906 0.48916913 0.88313663 49 | 0.09871110 0.49292919 0.87862013 50 | 0.09730966 0.49662346 0.87408301 51 | 0.09650479 0.50025068 0.86957504 52 | 0.09624584 0.50381202 0.86512287 53 | 0.09650092 0.50731024 0.86073459 54 | 0.09733926 0.51075184 0.85635832 55 | 0.09868124 0.51413736 0.85202354 56 | 0.10041772 0.51746734 0.84776981 57 | 0.10254357 0.52074581 0.84357808 58 | 0.10511892 0.52397754 0.83939670 59 | 0.10794994 0.52716063 0.83530992 60 | 0.11103428 0.53029902 0.83129562 61 | 0.11444866 0.53339644 0.82729714 62 | 0.11799620 0.53645246 0.82339831 63 | 0.12173324 0.53946979 0.81955819 64 | 0.12565194 0.54245158 0.81575885 65 | 0.12961274 0.54539724 0.81206996 66 | 0.13376180 0.54831131 0.80839194 67 | 0.13793738 0.55119366 0.80480637 68 | 0.14216868 0.55404611 0.80128911 69 | 0.14648133 0.55687084 0.79781298 70 | 0.15074973 0.55966858 0.79444619 71 | 0.15513929 0.56244187 0.79107836 72 | 0.15945400 0.56519092 0.78782705 73 | 0.16382921 0.56791765 0.78459984 74 | 0.16815570 0.57062326 0.78146070 75 | 0.17248911 0.57330902 0.77836849 76 | 0.17679543 0.57597614 0.77534119 77 | 0.18107122 0.57862579 0.77237722 78 | 0.18533225 0.58125897 0.76946194 79 | 0.18953856 0.58387700 0.76661965 80 | 0.19373461 0.58648054 0.76381592 81 | 0.19786251 0.58907113 0.76108892 82 | 0.20197807 0.59164910 0.75839583 83 | 0.20602062 0.59421610 0.75577841 84 | 0.21004339 0.59677234 0.75319468 85 | 0.21399545 0.59931948 0.75068022 86 | 0.21791582 0.60185771 0.74820338 87 | 0.22177323 0.60438842 0.74578584 88 | 0.22558336 0.60691209 0.74341378 89 | 0.22934230 0.60942945 0.74108908 90 | 0.23303563 0.61194175 0.73882024 91 | 0.23669375 0.61444901 0.73658083 92 | 0.24026561 0.61695321 0.73441052 93 | 0.24382048 0.61945329 0.73225052 94 | 0.24726785 0.62195210 0.73017637 95 | 0.25071534 0.62444760 0.72809360 96 | 0.25405952 0.62694336 0.72608828 97 | 0.25737416 0.62943785 0.72409565 98 | 0.26061262 0.63193286 0.72215620 99 | 0.26379183 0.63442876 0.72025129 100 | 0.26692331 0.63692577 0.71836855 101 | 0.26996536 0.63942550 0.71654712 102 | 0.27298778 0.64192655 0.71471824 103 | 0.27591395 0.64443196 0.71295134 104 | 0.27880385 0.64693996 0.71119123 105 | 0.28162110 0.64945262 0.70946759 106 | 0.28436948 0.65197016 0.70777673 107 | 0.28707660 0.65449205 0.70609026 108 | 0.28969317 0.65702064 0.70445385 109 | 0.29227949 0.65955408 0.70280707 110 | 0.29478641 0.66209468 0.70119634 111 | 0.29722957 0.66464219 0.69960549 112 | 0.29962622 0.66719652 0.69801347 113 | 0.30193756 0.66975927 0.69646115 114 | 0.30421357 0.67232918 0.69489216 115 | 0.30641581 0.67490794 0.69334637 116 | 0.30855032 0.67749535 0.69181895 117 | 0.31064369 0.68009145 0.69027257 118 | 0.31265743 0.68269702 0.68875690 119 | 0.31462449 0.68531199 0.68722576 120 | 0.31653182 0.68793652 0.68569766 121 | 0.31836334 0.69057138 0.68419061 122 | 0.32016471 0.69321586 0.68264340 123 | 0.32189316 0.69587089 0.68111247 124 | 0.32356194 0.69853634 0.67957975 125 | 0.32518941 0.70121221 0.67801733 126 | 0.32674753 0.70389892 0.67646510 127 | 0.32825952 0.70659612 0.67489082 128 | 0.32972158 0.70930436 0.67329472 129 | 0.33111979 0.71202312 0.67170506 130 | 0.33248152 0.71475297 0.67007183 131 | 0.33378938 0.71749370 0.66842524 132 | 0.33503864 0.72024476 0.66677917 133 | 0.33625914 0.72300729 0.66507218 134 | 0.33742347 0.72578094 0.66335285 135 | 0.33852858 0.72856879 0.66159231 136 | 0.33964303 0.73135579 0.65984123 137 | 0.34069072 0.73415971 0.65803103 138 | 0.34170081 0.73697388 0.65618557 139 | 0.34271076 0.73979044 0.65432929 140 | 0.34365906 0.74262331 0.65240974 141 | 0.34459900 0.74546081 0.65046725 142 | 0.34552289 0.74830516 0.64848944 143 | 0.34639090 0.75116503 0.64644477 144 | 0.34728627 0.75402283 0.64439156 145 | 0.34814490 0.75689243 0.64227978 146 | 0.34897135 0.75977342 0.64010521 147 | 0.34983186 0.76265135 0.63792151 148 | 0.35064339 0.76554476 0.63565428 149 | 0.35147542 0.76843856 0.63336025 150 | 0.35230447 0.77133844 0.63101218 151 | 0.35309985 0.77425081 0.62858593 152 | 0.35395844 0.77715553 0.62615332 153 | 0.35477932 0.78007417 0.62363071 154 | 0.35563122 0.78299239 0.62106987 155 | 0.35649728 0.78591410 0.61845275 156 | 0.35734937 0.78884529 0.61575407 157 | 0.35827283 0.79176843 0.61303869 158 | 0.35916838 0.79470453 0.61022124 159 | 0.36013369 0.79763314 0.60738248 160 | 0.36110286 0.80056876 0.60445720 161 | 0.36210643 0.80350487 0.60147198 162 | 0.36316256 0.80643793 0.59843878 163 | 0.36422160 0.80937877 0.59530679 164 | 0.36537547 0.81230821 0.59215638 165 | 0.36651593 0.81524921 0.58888530 166 | 0.36777244 0.81817472 0.58560944 167 | 0.36902799 0.82110970 0.58221419 168 | 0.37038245 0.82403342 0.57878832 169 | 0.37176459 0.82696101 0.57526110 170 | 0.37323606 0.82987967 0.57168791 171 | 0.37475726 0.83279800 0.56802499 172 | 0.37636431 0.83570857 0.56430370 173 | 0.37803640 0.83861603 0.56049800 174 | 0.37979814 0.84151534 0.55662829 175 | 0.38163303 0.84441023 0.55267208 176 | 0.38356909 0.84729489 0.54865414 177 | 0.38557875 0.85017543 0.54453900 178 | 0.38770925 0.85304184 0.54037355 179 | 0.38990578 0.85590612 0.53609023 180 | 0.39225132 0.85875043 0.53177866 181 | 0.39464890 0.86159598 0.52731933 182 | 0.39722857 0.86441455 0.52286027 183 | 0.39987651 0.86723139 0.51825352 184 | 0.40267555 0.87002811 0.51359839 185 | 0.40559611 0.87281125 0.50885216 186 | 0.40862782 0.87558357 0.50398646 187 | 0.41184462 0.87832822 0.49909670 188 | 0.41516836 0.88106286 0.49406862 189 | 0.41866035 0.88377381 0.48897314 190 | 0.42232162 0.88646051 0.48380791 191 | 0.42611861 0.88913084 0.47851016 192 | 0.43011097 0.89177096 0.47315546 193 | 0.43429142 0.89438212 0.46772755 194 | 0.43863926 0.89696922 0.46217838 195 | 0.44317862 0.89952664 0.45652686 196 | 0.44796334 0.90204082 0.45085308 197 | 0.45295204 0.90452151 0.44507230 198 | 0.45816038 0.90696458 0.43919293 199 | 0.46360715 0.90936545 0.43321935 200 | 0.46932082 0.91171595 0.42719396 201 | 0.47532103 0.91401008 0.42114031 202 | 0.48160825 0.91624757 0.41502280 203 | 0.48819935 0.91842235 0.40886754 204 | 0.49511823 0.92052730 0.40269129 205 | 0.50238678 0.92255487 0.39652146 206 | 0.51002610 0.92449699 0.39039291 207 | 0.51805983 0.92634468 0.38434296 208 | 0.52650519 0.92808911 0.37842507 209 | 0.53539155 0.92971673 0.37274395 210 | 0.54473593 0.93121556 0.36741360 211 | 0.55451105 0.93258488 0.36247802 212 | 0.56468819 0.93382183 0.35804854 213 | 0.57525878 0.93491327 0.35440861 214 | 0.58610894 0.93587852 0.35157765 215 | 0.59713617 0.93673250 0.34967460 216 | 0.60825245 0.93748585 0.34889199 217 | 0.61929886 0.93817925 0.34908490 218 | 0.63021003 0.93882511 0.35035586 219 | 0.64089945 0.93945022 0.35257940 220 | 0.65130842 0.94007692 0.35560665 221 | 0.66141850 0.94071620 0.35934982 222 | 0.67124515 0.94136779 0.36379761 223 | 0.68077168 0.94204577 0.36876888 224 | 0.69001294 0.94275256 0.37418054 225 | 0.69898400 0.94348971 0.37996422 226 | 0.70770221 0.94425759 0.38606007 227 | 0.71629104 0.94502914 0.39236278 228 | 0.72478568 0.94580725 0.39859599 229 | 0.73319050 0.94659183 0.40476245 230 | 0.74150959 0.94738280 0.41086468 231 | 0.74974683 0.94818007 0.41690500 232 | 0.75790593 0.94898354 0.42288558 233 | 0.76599041 0.94979310 0.42880845 234 | 0.77400364 0.95060863 0.43467550 235 | 0.78195079 0.95142936 0.44048977 236 | 0.78983380 0.95225551 0.44625216 237 | 0.79765534 0.95308704 0.45196402 238 | 0.80540667 0.95392779 0.45761933 239 | 0.81310454 0.95477282 0.46322856 240 | 0.82075288 0.95562148 0.46879380 241 | 0.82835505 0.95647325 0.47431676 242 | 0.83589095 0.95733600 0.47978422 243 | 0.84338926 0.95820018 0.48521407 244 | 0.85084532 0.95906802 0.49060291 245 | 0.85825015 0.95994345 0.49594464 246 | 0.86562633 0.96081871 0.50125308 247 | 0.87295153 0.96170268 0.50651382 248 | 0.88024703 0.96258791 0.51173979 249 | 0.88751495 0.96347404 0.51693182 250 | 0.89473767 0.96436836 0.52207872 251 | 0.90193514 0.96526364 0.52719240 252 | 0.90910727 0.96616032 0.53227242 253 | 0.91625756 0.96705742 0.53732051 254 | 0.92337667 0.96795906 0.54233078 255 | 0.93048556 0.96885719 0.54731539 256 | 0.93757415 0.96975618 0.55226804 257 | 0.94465010 0.97065323 0.55719294 258 | 0.95174464 0.97153564 0.56210779 259 | 0.95897677 0.97235364 0.56707975 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_bmrygcw.m: -------------------------------------------------------------------------------- 1 | function colors = kb_bmrygcw(ncolors) 2 | 3 | cm = [ 4 | 0.08060657 0.22456473 0.71347976 5 | 0.11458385 0.22046784 0.71926202 6 | 0.14047854 0.21637838 0.72520733 7 | 0.16260738 0.21201020 0.73144717 8 | 0.18230834 0.20731675 0.73798593 9 | 0.20040356 0.20219812 0.74485674 10 | 0.21724349 0.19663694 0.75203997 11 | 0.23314665 0.19055392 0.75954623 12 | 0.24830444 0.18388070 0.76737184 13 | 0.26294571 0.17645549 0.77555559 14 | 0.27709965 0.16822135 0.78406131 15 | 0.29090414 0.15897229 0.79291539 16 | 0.30424743 0.14930932 0.80111320 17 | 0.31719953 0.13959037 0.80805630 18 | 0.32975171 0.12978644 0.81390853 19 | 0.34186152 0.12026087 0.81839710 20 | 0.35354897 0.11088703 0.82183240 21 | 0.36479536 0.10199014 0.82406424 22 | 0.37561904 0.09361661 0.82523908 23 | 0.38604370 0.08577770 0.82551377 24 | 0.39606684 0.07887918 0.82475381 25 | 0.40573381 0.07276997 0.82322600 26 | 0.41507227 0.06749397 0.82102409 27 | 0.42410221 0.06320038 0.81816370 28 | 0.43284694 0.05998038 0.81468135 29 | 0.44134333 0.05763303 0.81074721 30 | 0.44961736 0.05610289 0.80641868 31 | 0.45769234 0.05530878 0.80174995 32 | 0.46559067 0.05514855 0.79679005 33 | 0.47333161 0.05551155 0.79158548 34 | 0.48093554 0.05629209 0.78616794 35 | 0.48841914 0.05739580 0.78056485 36 | 0.49580139 0.05867004 0.77483538 37 | 0.50309703 0.06002973 0.76900586 38 | 0.51031966 0.06140163 0.76309885 39 | 0.51748100 0.06273152 0.75712964 40 | 0.52458942 0.06400408 0.75109452 41 | 0.53165860 0.06513925 0.74502365 42 | 0.53869690 0.06609906 0.73893095 43 | 0.54565683 0.06712548 0.73276709 44 | 0.55255174 0.06823292 0.72648760 45 | 0.55938575 0.06940323 0.72009745 46 | 0.56616308 0.07061851 0.71360120 47 | 0.57288775 0.07186158 0.70700348 48 | 0.57956363 0.07311608 0.70030894 49 | 0.58618752 0.07441341 0.69350219 50 | 0.59275650 0.07577625 0.68657326 51 | 0.59928829 0.07710351 0.67955837 52 | 0.60578605 0.07838294 0.67246184 53 | 0.61225330 0.07960259 0.66528644 54 | 0.61869373 0.08075104 0.65803396 55 | 0.62511004 0.08181846 0.65070805 56 | 0.63149396 0.08286296 0.64328167 57 | 0.63784777 0.08387933 0.63575319 58 | 0.64418677 0.08478481 0.62815491 59 | 0.65051334 0.08557180 0.62048860 60 | 0.65683011 0.08623255 0.61275465 61 | 0.66313966 0.08675935 0.60495276 62 | 0.66941931 0.08728744 0.59702150 63 | 0.67569492 0.08767292 0.58901940 64 | 0.68196967 0.08790170 0.58094909 65 | 0.68824531 0.08796666 0.57280999 66 | 0.69451683 0.08789852 0.56458480 67 | 0.70077165 0.08777140 0.55623721 68 | 0.70703193 0.08745723 0.54781871 69 | 0.71329893 0.08694747 0.53932799 70 | 0.71957185 0.08624405 0.53075867 71 | 0.72582741 0.08548260 0.52204713 72 | 0.73209293 0.08449621 0.51325922 73 | 0.73836907 0.08327263 0.50439347 74 | 0.74464856 0.08184716 0.49542775 75 | 0.75091935 0.08028742 0.48632651 76 | 0.75720232 0.07844669 0.47714376 77 | 0.76349752 0.07630433 0.46787868 78 | 0.76978385 0.07398622 0.45846822 79 | 0.77607688 0.07136479 0.44895201 80 | 0.78238297 0.06836010 0.43934811 81 | 0.78868829 0.06503508 0.42961733 82 | 0.79499243 0.06135606 0.41975078 83 | 0.80121861 0.05772826 0.40978112 84 | 0.80725835 0.05495686 0.39962457 85 | 0.81300076 0.05384924 0.38935763 86 | 0.81856499 0.05376597 0.37891692 87 | 0.82392247 0.05490624 0.36832673 88 | 0.82895390 0.05796601 0.35767527 89 | 0.83366135 0.06275732 0.34698149 90 | 0.83809085 0.06877762 0.33623784 91 | 0.84221962 0.07592055 0.32548547 92 | 0.84602866 0.08404501 0.31476780 93 | 0.84938754 0.09349513 0.30421381 94 | 0.85239545 0.10356288 0.29379181 95 | 0.85505877 0.11406690 0.28353603 96 | 0.85737883 0.12488819 0.27348544 97 | 0.85936288 0.13591988 0.26367270 98 | 0.86094538 0.14729188 0.25418571 99 | 0.86216508 0.15881846 0.24502793 100 | 0.86309347 0.17028059 0.23616958 101 | 0.86375342 0.18162794 0.22761390 102 | 0.86416799 0.19282309 0.21935846 103 | 0.86420026 0.20416608 0.21153668 104 | 0.86403204 0.21527415 0.20400061 105 | 0.86368901 0.22613181 0.19673028 106 | 0.86312724 0.23684826 0.18976613 107 | 0.86230389 0.24750987 0.18315251 108 | 0.86137100 0.25787926 0.17674885 109 | 0.86029001 0.26805009 0.17057654 110 | 0.85896667 0.27817883 0.16473861 111 | 0.85758503 0.28801247 0.15903542 112 | 0.85603893 0.29772253 0.15358198 113 | 0.85433928 0.30730656 0.14834832 114 | 0.85262816 0.31659869 0.14318621 115 | 0.85064597 0.32593607 0.13837178 116 | 0.84867445 0.33498681 0.13358324 117 | 0.84652930 0.34398128 0.12902467 118 | 0.84432060 0.35280326 0.12456553 119 | 0.84201413 0.36150136 0.12024693 120 | 0.83959295 0.37010145 0.11607936 121 | 0.83711609 0.37855150 0.11198477 122 | 0.83449819 0.38694305 0.10806959 123 | 0.83184370 0.39518176 0.10419346 124 | 0.82904435 0.40337504 0.10049912 125 | 0.82620460 0.41143249 0.09684352 126 | 0.82323985 0.41943436 0.09334579 127 | 0.82020615 0.42733617 0.08991978 128 | 0.81708396 0.43515892 0.08659153 129 | 0.81384308 0.44292991 0.08340741 130 | 0.81057165 0.45058304 0.08022669 131 | 0.80711884 0.45823686 0.07731202 132 | 0.80360348 0.46580880 0.07417853 133 | 0.80003792 0.47327685 0.07157820 134 | 0.79634301 0.48072014 0.06872622 135 | 0.79256759 0.48808990 0.06629917 136 | 0.78866928 0.49542719 0.06383568 137 | 0.78467278 0.50270815 0.06172858 138 | 0.78055500 0.50995296 0.05979082 139 | 0.77631981 0.51715677 0.05817606 140 | 0.77196088 0.52432366 0.05691179 141 | 0.76746888 0.53145972 0.05598407 142 | 0.76284521 0.53856160 0.05553761 143 | 0.75807720 0.54563763 0.05549179 144 | 0.75316668 0.55268385 0.05597984 145 | 0.74810415 0.55970496 0.05697976 146 | 0.74287894 0.56670575 0.05846166 147 | 0.73749857 0.57367765 0.06060977 148 | 0.73193032 0.58064084 0.06307853 149 | 0.72620974 0.58756642 0.06640717 150 | 0.72026662 0.59449907 0.06979748 151 | 0.71418069 0.60138045 0.07427924 152 | 0.70785232 0.60827158 0.07882384 153 | 0.70133316 0.61513374 0.08406821 154 | 0.69459291 0.62198199 0.08971404 155 | 0.68759986 0.62882883 0.09560026 156 | 0.68040974 0.63563552 0.10228075 157 | 0.67294041 0.64244479 0.10908365 158 | 0.66522023 0.64923244 0.11638178 159 | 0.65725009 0.65599290 0.12417655 160 | 0.64896898 0.66275119 0.13214900 161 | 0.64042517 0.66947494 0.14066752 162 | 0.63159712 0.67616921 0.14961010 163 | 0.62243280 0.68285109 0.15878184 164 | 0.61296988 0.68949556 0.16839658 165 | 0.60322350 0.69608952 0.17852980 166 | 0.59313462 0.70265284 0.18892857 167 | 0.58270102 0.70917877 0.19961480 168 | 0.57200746 0.71562622 0.21089724 169 | 0.56099872 0.72201354 0.22252794 170 | 0.54966637 0.72833894 0.23445271 171 | 0.53802133 0.73459355 0.24667544 172 | 0.52616763 0.74073790 0.25941184 173 | 0.51407070 0.74678380 0.27248531 174 | 0.50172718 0.75273156 0.28581888 175 | 0.48916177 0.75857305 0.29939773 176 | 0.47645308 0.76428613 0.31329110 177 | 0.46368424 0.76985145 0.32753951 178 | 0.45079904 0.77528985 0.34195567 179 | 0.43782822 0.78059745 0.35651231 180 | 0.42480479 0.78577101 0.37118474 181 | 0.41196835 0.79076186 0.38617444 182 | 0.39916224 0.79561625 0.40121179 183 | 0.38617292 0.80037448 0.41624840 184 | 0.37287073 0.80506067 0.43118390 185 | 0.35951116 0.80963434 0.44603981 186 | 0.34587732 0.81412686 0.46082608 187 | 0.33195793 0.81853679 0.47555555 188 | 0.31776609 0.82285954 0.49023978 189 | 0.30332679 0.82708985 0.50488584 190 | 0.28894327 0.83119362 0.51950381 191 | 0.27443171 0.83519389 0.53409533 192 | 0.25983990 0.83908690 0.54866730 193 | 0.24526888 0.84286623 0.56321637 194 | 0.23083991 0.84652597 0.57774481 195 | 0.21672065 0.85005996 0.59224928 196 | 0.20312812 0.85346223 0.60672572 197 | 0.19034390 0.85672698 0.62116604 198 | 0.17896830 0.85983393 0.63556224 199 | 0.16919319 0.86279380 0.64990075 200 | 0.16146279 0.86560318 0.66417050 201 | 0.15623705 0.86825870 0.67835569 202 | 0.15390169 0.87075800 0.69244012 203 | 0.15468908 0.87309981 0.70640730 204 | 0.15862360 0.87528411 0.72023937 205 | 0.16551774 0.87731215 0.73391840 206 | 0.17502300 0.87918646 0.74742727 207 | 0.18670664 0.88091094 0.76074878 208 | 0.20012324 0.88249063 0.77386793 209 | 0.21486203 0.88393164 0.78677153 210 | 0.23056756 0.88524129 0.79944723 211 | 0.24694636 0.88642761 0.81188568 212 | 0.26376356 0.88749906 0.82408113 213 | 0.28083322 0.88846491 0.83602620 214 | 0.29821300 0.88931452 0.84771241 215 | 0.31556815 0.89007646 0.85914478 216 | 0.33281293 0.89075985 0.87032850 217 | 0.34987183 0.89137537 0.88126479 218 | 0.36669644 0.89193150 0.89196395 219 | 0.38335523 0.89241149 0.90254190 220 | 0.39963216 0.89285628 0.91292599 221 | 0.41565017 0.89325775 0.92308926 222 | 0.43152766 0.89360584 0.93299948 223 | 0.44738436 0.89388777 0.94261869 224 | 0.46333534 0.89408972 0.95189688 225 | 0.47949272 0.89419672 0.96077037 226 | 0.49598218 0.89418916 0.96916597 227 | 0.51290752 0.89405080 0.97698375 228 | 0.53046139 0.89376305 0.98395424 229 | 0.54868808 0.89331794 0.98993445 230 | 0.56762366 0.89272125 0.99465572 231 | 0.58713259 0.89201009 0.99790253 232 | 0.60701003 0.89125692 0.99933442 233 | 0.62673208 0.89056615 0.99908938 234 | 0.64583466 0.89004000 0.99736248 235 | 0.66406999 0.88974601 0.99429277 236 | 0.68117835 0.88971337 0.99045008 237 | 0.69722662 0.88993664 0.98595933 238 | 0.71221751 0.89039683 0.98119556 239 | 0.72629091 0.89106876 0.97621451 240 | 0.73954899 0.89192767 0.97112384 241 | 0.75205661 0.89295333 0.96606360 242 | 0.76390679 0.89412547 0.96107313 243 | 0.77518352 0.89542573 0.95617582 244 | 0.78616997 0.89677843 0.95129310 245 | 0.79684021 0.89817202 0.94665359 246 | 0.80721076 0.89960683 0.94225269 247 | 0.81729613 0.90108334 0.93808638 248 | 0.82711592 0.90260049 0.93414385 249 | 0.83666814 0.90416213 0.93043543 250 | 0.84594076 0.90577461 0.92698091 251 | 0.85498076 0.90742983 0.92373463 252 | 0.86377653 0.90913405 0.92070975 253 | 0.87230892 0.91089611 0.91792235 254 | 0.88058280 0.91271981 0.91535183 255 | 0.88858533 0.91461555 0.91297644 256 | 0.89627198 0.91660609 0.91077124 257 | 0.90362807 0.91871431 0.90860178 258 | 0.91063146 0.92097567 0.90623595 259 | 0.91761743 0.92334408 0.90287020 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_bw.m: -------------------------------------------------------------------------------- 1 | function colors = kb_bw(ncolors) 2 | 3 | cm = [ 4 | 0.11822535 0.14870794 0.44086858 5 | 0.12017906 0.15090006 0.44788768 6 | 0.12214486 0.15311977 0.45478402 7 | 0.12410669 0.15532721 0.46170304 8 | 0.12606510 0.15752331 0.46864186 9 | 0.12801885 0.15970430 0.47561430 10 | 0.12996907 0.16187254 0.48261231 11 | 0.13191420 0.16402308 0.48965349 12 | 0.13385528 0.16615797 0.49673069 13 | 0.13579267 0.16827743 0.50384328 14 | 0.13772665 0.17038153 0.51099107 15 | 0.13965653 0.17246728 0.51818436 16 | 0.14158293 0.17453557 0.52541992 17 | 0.14350706 0.17658928 0.53268799 18 | 0.14542773 0.17862361 0.54000457 19 | 0.14734622 0.18064173 0.54735897 20 | 0.14926208 0.18264098 0.55475971 21 | 0.15117656 0.18462465 0.56219588 22 | 0.15308818 0.18658613 0.56968868 23 | 0.15499898 0.18853174 0.57721730 24 | 0.15690866 0.19045911 0.58478915 25 | 0.15881653 0.19236407 0.59241708 26 | 0.16072412 0.19425128 0.60008588 27 | 0.16263155 0.19611998 0.60779762 28 | 0.16453894 0.19796917 0.61555498 29 | 0.16644595 0.19979554 0.62336766 30 | 0.16835332 0.20160064 0.63123028 31 | 0.17026156 0.20338512 0.63914025 32 | 0.17217085 0.20514814 0.64709957 33 | 0.17408153 0.20688930 0.65510876 34 | 0.17599391 0.20860832 0.66316808 35 | 0.17790825 0.21030440 0.67127913 36 | 0.17978012 0.21201145 0.67938977 37 | 0.18156978 0.21372792 0.68754171 38 | 0.18326694 0.21545862 0.69573162 39 | 0.18485891 0.21720847 0.70395807 40 | 0.18631912 0.21900196 0.71217971 41 | 0.18764068 0.22083249 0.72042077 42 | 0.18880400 0.22270868 0.72867566 43 | 0.18977447 0.22465764 0.73690286 44 | 0.19051731 0.22670275 0.74507039 45 | 0.19100457 0.22885493 0.75317183 46 | 0.19117840 0.23116465 0.76112103 47 | 0.19099312 0.23366606 0.76886110 48 | 0.19040245 0.23639951 0.77631463 49 | 0.18935781 0.23942154 0.78335720 50 | 0.18783277 0.24278123 0.78985646 51 | 0.18583647 0.24650804 0.79569275 52 | 0.18341861 0.25060271 0.80078204 53 | 0.18065811 0.25503557 0.80509563 54 | 0.17764973 0.25974914 0.80867184 55 | 0.17448067 0.26467641 0.81159114 56 | 0.17122413 0.26975079 0.81395687 57 | 0.16792697 0.27492642 0.81584592 58 | 0.16461703 0.28016750 0.81732933 59 | 0.16133163 0.28542929 0.81850776 60 | 0.15807999 0.29069741 0.81941828 61 | 0.15486987 0.29595748 0.82010240 62 | 0.15172098 0.30118640 0.82062596 63 | 0.14863553 0.30637925 0.82101241 64 | 0.14561262 0.31153759 0.82126656 65 | 0.14265578 0.31665461 0.82141851 66 | 0.13977467 0.32172376 0.82149575 67 | 0.13697068 0.32674457 0.82151095 68 | 0.13424544 0.33171697 0.82147524 69 | 0.13160210 0.33664084 0.82139915 70 | 0.12904438 0.34151621 0.82129232 71 | 0.12657264 0.34634431 0.82116164 72 | 0.12419122 0.35112546 0.82101515 73 | 0.12189821 0.35586406 0.82084799 74 | 0.11969670 0.36056133 0.82066421 75 | 0.11759283 0.36521521 0.82047920 76 | 0.11558983 0.36982667 0.82029809 77 | 0.11369255 0.37439629 0.82012641 78 | 0.11190185 0.37892567 0.81996723 79 | 0.11020815 0.38342524 0.81979028 80 | 0.10862508 0.38788790 0.81962766 81 | 0.10715644 0.39231370 0.81948631 82 | 0.10580547 0.39670354 0.81936967 83 | 0.10455947 0.40106967 0.81923696 84 | 0.10343347 0.40540260 0.81913084 85 | 0.10242900 0.40970311 0.81905489 86 | 0.10153917 0.41397950 0.81898096 87 | 0.10076913 0.41822950 0.81892335 88 | 0.10012241 0.42245024 0.81890040 89 | 0.09958327 0.42665169 0.81887703 90 | 0.09930484 0.43082357 0.81884752 91 | 0.09921451 0.43497330 0.81881054 92 | 0.09945636 0.43909444 0.81874621 93 | 0.09995622 0.44319129 0.81866709 94 | 0.10067432 0.44726655 0.81857885 95 | 0.10174417 0.45131381 0.81846369 96 | 0.10309180 0.45533710 0.81833235 97 | 0.10467135 0.45933894 0.81819135 98 | 0.10658030 0.46331433 0.81802708 99 | 0.10878840 0.46726467 0.81784342 100 | 0.11122300 0.47119365 0.81764996 101 | 0.11392826 0.47509854 0.81744031 102 | 0.11695394 0.47897623 0.81720604 103 | 0.12018617 0.48283238 0.81696325 104 | 0.12361805 0.48666702 0.81671196 105 | 0.12736587 0.49047282 0.81643333 106 | 0.13130424 0.49425626 0.81614586 107 | 0.13541175 0.49801809 0.81585221 108 | 0.13972754 0.50175529 0.81554507 109 | 0.14426672 0.50546611 0.81522063 110 | 0.14894267 0.50915538 0.81489281 111 | 0.15374703 0.51282317 0.81456259 112 | 0.15875567 0.51646359 0.81421578 113 | 0.16389637 0.52008092 0.81386444 114 | 0.16913548 0.52367712 0.81351437 115 | 0.17447520 0.52725162 0.81316500 116 | 0.17998668 0.53079830 0.81280216 117 | 0.18557000 0.53432443 0.81244482 118 | 0.19121879 0.53783029 0.81209438 119 | 0.19696447 0.54131292 0.81174441 120 | 0.20281367 0.54477127 0.81139322 121 | 0.20870643 0.54821034 0.81105345 122 | 0.21463751 0.55163052 0.81072668 123 | 0.22066673 0.55502599 0.81039962 124 | 0.22674030 0.55840163 0.81008419 125 | 0.23283468 0.56175975 0.80978606 126 | 0.23896333 0.56509907 0.80950243 127 | 0.24516503 0.56841537 0.80922426 128 | 0.25137287 0.57171575 0.80896769 129 | 0.25758366 0.57500084 0.80873383 130 | 0.26385299 0.57826445 0.80850893 131 | 0.27013358 0.58151200 0.80830508 132 | 0.27640561 0.58474607 0.80812792 133 | 0.28270095 0.58796313 0.80796900 134 | 0.28902095 0.59116312 0.80782795 135 | 0.29532305 0.59435158 0.80771706 136 | 0.30162612 0.59752655 0.80763086 137 | 0.30795855 0.60068453 0.80756133 138 | 0.31426591 0.60383297 0.80752454 139 | 0.32056346 0.60697036 0.80751574 140 | 0.32688698 0.61009195 0.80752473 141 | 0.33318008 0.61320601 0.80756836 142 | 0.33946264 0.61631027 0.80764021 143 | 0.34576029 0.61940108 0.80773362 144 | 0.35202432 0.62248630 0.80786222 145 | 0.35828422 0.62556176 0.80801806 146 | 0.36454440 0.62862723 0.80819882 147 | 0.37076667 0.63168906 0.80841736 148 | 0.37700091 0.63473980 0.80865694 149 | 0.38321267 0.63778526 0.80892965 150 | 0.38939211 0.64082773 0.80923756 151 | 0.39559025 0.64385886 0.80956495 152 | 0.40174746 0.64688928 0.80993081 153 | 0.40789950 0.64991330 0.81032301 154 | 0.41403867 0.65293251 0.81074499 155 | 0.42014010 0.65595196 0.81120419 156 | 0.42626031 0.65896174 0.81168143 157 | 0.43233713 0.66197357 0.81219856 158 | 0.43841245 0.66498016 0.81274053 159 | 0.44446781 0.66798536 0.81331358 160 | 0.45049826 0.67099054 0.81391952 161 | 0.45653009 0.67399089 0.81454951 162 | 0.46251896 0.67699562 0.81521862 163 | 0.46852597 0.67999290 0.81590507 164 | 0.47449109 0.68299517 0.81663024 165 | 0.48045807 0.68599391 0.81737840 166 | 0.48639831 0.68899531 0.81816013 167 | 0.49232723 0.69199658 0.81896948 168 | 0.49824271 0.69499849 0.81980710 169 | 0.50413657 0.69800315 0.82067600 170 | 0.51002694 0.70100697 0.82156945 171 | 0.51588800 0.70401593 0.82249690 172 | 0.52175337 0.70702296 0.82344575 173 | 0.52758397 0.71003706 0.82443060 174 | 0.53342437 0.71304855 0.82543458 175 | 0.53922665 0.71606861 0.82647580 176 | 0.54504224 0.71908577 0.82753463 177 | 0.55081823 0.72211256 0.82863122 178 | 0.55660925 0.72513654 0.82974456 179 | 0.56236092 0.72817081 0.83089556 180 | 0.56812771 0.73120272 0.83206308 181 | 0.57385693 0.73424516 0.83326752 182 | 0.57959989 0.73728605 0.83448886 183 | 0.58530848 0.74033737 0.83574585 184 | 0.59102807 0.74338824 0.83702063 185 | 0.59671774 0.74644908 0.83832928 186 | 0.60241430 0.74951094 0.83965733 187 | 0.60808611 0.75258203 0.84101739 188 | 0.61375992 0.75565587 0.84239858 189 | 0.61941598 0.75873773 0.84380873 190 | 0.62506803 0.76182436 0.84524231 191 | 0.63072096 0.76491541 0.84669091 192 | 0.63635874 0.76801554 0.84815895 193 | 0.64197715 0.77112578 0.84965123 194 | 0.64758581 0.77424443 0.85115885 195 | 0.65317207 0.77737420 0.85269493 196 | 0.65875294 0.78051189 0.85424310 197 | 0.66431008 0.78366140 0.85582227 198 | 0.66986493 0.78681853 0.85741143 199 | 0.67539581 0.78998795 0.85903301 200 | 0.68092628 0.79316495 0.86066361 201 | 0.68643357 0.79635446 0.86232692 202 | 0.69194117 0.79955173 0.86399945 203 | 0.69742742 0.80276152 0.86570387 204 | 0.70291351 0.80597949 0.86741884 205 | 0.70838115 0.80920973 0.86916372 206 | 0.71384700 0.81244882 0.87092168 207 | 0.71929831 0.81569969 0.87270641 208 | 0.72474507 0.81896033 0.87450794 209 | 0.73018225 0.82223200 0.87633194 210 | 0.73561098 0.82551462 0.87817765 211 | 0.74103613 0.82880726 0.88004032 212 | 0.74644799 0.83211227 0.88193064 213 | 0.75186410 0.83542583 0.88383038 214 | 0.75726058 0.83875352 0.88576533 215 | 0.76266142 0.84209004 0.88771030 216 | 0.76804994 0.84543935 0.88968350 217 | 0.77343636 0.84879925 0.89167433 218 | 0.77882092 0.85216984 0.89368289 219 | 0.78419268 0.85555382 0.89572134 220 | 0.78956925 0.85894721 0.89777101 221 | 0.79493448 0.86235396 0.89984971 222 | 0.80029772 0.86577201 0.90194768 223 | 0.80566408 0.86920029 0.90405964 224 | 0.81101522 0.87264331 0.90620597 225 | 0.81636946 0.87609685 0.90836698 226 | 0.82172499 0.87956148 0.91054495 227 | 0.82706800 0.88304067 0.91275538 228 | 0.83241414 0.88653079 0.91498137 229 | 0.83776279 0.89003211 0.91722391 230 | 0.84309963 0.89354828 0.91949912 231 | 0.84843780 0.89707623 0.92179277 232 | 0.85377780 0.90061598 0.92410462 233 | 0.85911577 0.90416860 0.92643921 234 | 0.86444693 0.90773545 0.92880218 235 | 0.86977935 0.91131466 0.93118481 236 | 0.87511270 0.91490645 0.93358772 237 | 0.88044670 0.91851102 0.93601149 238 | 0.88577587 0.92212992 0.93846251 239 | 0.89110242 0.92576273 0.94093854 240 | 0.89642934 0.92940884 0.94343646 241 | 0.90175618 0.93306852 0.94595696 242 | 0.90708255 0.93674202 0.94850066 243 | 0.91240801 0.94042961 0.95106822 244 | 0.91773285 0.94413137 0.95365939 245 | 0.92305632 0.94784767 0.95627512 246 | 0.92837832 0.95157870 0.95891555 247 | 0.93369915 0.95532456 0.96158025 248 | 0.93901901 0.95908540 0.96426889 249 | 0.94433807 0.96286137 0.96698097 250 | 0.94965508 0.96665301 0.96971756 251 | 0.95496436 0.97046206 0.97248464 252 | 0.96027525 0.97428632 0.97527059 253 | 0.96558062 0.97812798 0.97808255 254 | 0.97088483 0.98198621 0.98091387 255 | 0.97617922 0.98586372 0.98377272 256 | 0.98147089 0.98975908 0.98664792 257 | 0.98675573 0.99367395 0.98954069 258 | 0.99203806 0.99760792 0.99244070 259 | ]; 260 | cmsize = size(cm, 1); 261 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 262 | 263 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_mbcgy.m: -------------------------------------------------------------------------------- 1 | function colors = kb_mbcgy(ncolors) 2 | 3 | cm = [ 4 | 0.60667301 0.08738867 0.42783488 5 | 0.60595679 0.09412070 0.43692526 6 | 0.60533648 0.10026919 0.44575594 7 | 0.60473657 0.10602358 0.45453933 8 | 0.60415516 0.11143587 0.46328732 9 | 0.60358503 0.11655272 0.47202695 10 | 0.60302739 0.12140203 0.48076228 11 | 0.60248920 0.12600087 0.48948136 12 | 0.60196558 0.13037431 0.49820560 13 | 0.60145676 0.13453816 0.50694242 14 | 0.60096659 0.13850266 0.51568907 15 | 0.60049595 0.14227859 0.52445126 16 | 0.60004188 0.14587731 0.53324646 17 | 0.59961011 0.14930267 0.54206639 18 | 0.59920473 0.15255920 0.55090711 19 | 0.59881796 0.15565638 0.55980171 20 | 0.59845805 0.15859431 0.56873351 21 | 0.59812164 0.16137778 0.57772248 22 | 0.59781455 0.16400730 0.58675864 23 | 0.59753109 0.16648618 0.59587065 24 | 0.59727973 0.16881353 0.60503869 25 | 0.59705336 0.17099074 0.61429750 26 | 0.59685721 0.17301661 0.62363818 27 | 0.59669362 0.17489039 0.63306130 28 | 0.59656031 0.17661042 0.64258516 29 | 0.59645660 0.17817386 0.65222299 30 | 0.59638655 0.17957856 0.66196830 31 | 0.59634936 0.18082072 0.67183441 32 | 0.59634690 0.18189687 0.68182319 33 | 0.59632962 0.18293785 0.69182229 34 | 0.59625683 0.18400594 0.70183475 35 | 0.59612794 0.18509517 0.71187290 36 | 0.59593994 0.18620951 0.72193570 37 | 0.59568741 0.18735710 0.73202101 38 | 0.59536530 0.18854704 0.74212317 39 | 0.59495762 0.18982541 0.75219549 40 | 0.59446697 0.19117574 0.76225987 41 | 0.59388830 0.19260398 0.77231571 42 | 0.59321143 0.19413615 0.78233745 43 | 0.59242100 0.19581318 0.79228431 44 | 0.59152149 0.19760950 0.80218745 45 | 0.59049985 0.19955902 0.81201087 46 | 0.58933990 0.20170338 0.82171042 47 | 0.58804777 0.20401117 0.83131984 48 | 0.58659760 0.20655614 0.84075469 49 | 0.58499303 0.20931229 0.85004072 50 | 0.58321875 0.21231695 0.85912909 51 | 0.58126507 0.21558414 0.86799730 52 | 0.57912587 0.21912004 0.87662537 53 | 0.57678924 0.22294783 0.88497070 54 | 0.57424806 0.22706974 0.89301531 55 | 0.57149719 0.23148883 0.90073106 56 | 0.56852250 0.23622746 0.90806766 57 | 0.56533347 0.24124355 0.91504686 58 | 0.56190240 0.24659986 0.92155707 59 | 0.55825051 0.25221996 0.92766063 60 | 0.55436209 0.25813316 0.93328103 61 | 0.55024150 0.26431428 0.93840998 62 | 0.54590117 0.27071752 0.94307108 63 | 0.54132388 0.27737927 0.94716591 64 | 0.53653645 0.28422063 0.95076824 65 | 0.53154155 0.29123013 0.95385395 66 | 0.52633979 0.29840318 0.95638654 67 | 0.52095781 0.30567235 0.95843955 68 | 0.51539275 0.31304833 0.95995566 69 | 0.50966636 0.32048050 0.96099251 70 | 0.50379314 0.32794262 0.96156874 71 | 0.49777688 0.33543213 0.96166303 72 | 0.49164819 0.34289007 0.96137164 73 | 0.48539739 0.35034498 0.96061912 74 | 0.47906373 0.35772571 0.95954281 75 | 0.47263496 0.36506671 0.95805934 76 | 0.46614020 0.37231048 0.95630271 77 | 0.45959889 0.37940608 0.95442337 78 | 0.45297993 0.38635092 0.95250866 79 | 0.44629658 0.39315620 0.95052182 80 | 0.43953013 0.39982816 0.94849340 81 | 0.43269698 0.40637503 0.94638668 82 | 0.42577717 0.41280153 0.94423411 83 | 0.41878735 0.41911479 0.94199894 84 | 0.41171018 0.42531856 0.93970842 85 | 0.40455525 0.43141838 0.93733963 86 | 0.39731651 0.43741779 0.93489991 87 | 0.38999063 0.44332029 0.93239105 88 | 0.38258792 0.44912995 0.92979178 89 | 0.37509343 0.45484869 0.92712472 90 | 0.36751844 0.46047979 0.92436889 91 | 0.35986049 0.46602511 0.92152814 92 | 0.35211150 0.47148669 0.91861179 93 | 0.34428826 0.47686627 0.91559767 94 | 0.33638234 0.48216535 0.91249722 95 | 0.32839003 0.48738523 0.90931579 96 | 0.32032743 0.49252661 0.90603777 97 | 0.31219340 0.49759049 0.90266726 98 | 0.30398128 0.50257813 0.89921291 99 | 0.29569819 0.50748985 0.89567224 100 | 0.28736867 0.51232521 0.89202953 101 | 0.27897602 0.51708562 0.88830413 102 | 0.27052568 0.52177147 0.88449686 103 | 0.26203121 0.52638267 0.88060411 104 | 0.25351451 0.53091868 0.87661912 105 | 0.24496336 0.53538081 0.87255795 106 | 0.23638631 0.53976934 0.86842304 107 | 0.22779547 0.54408442 0.86421582 108 | 0.21923067 0.54832482 0.85992559 109 | 0.21067466 0.55249248 0.85557169 110 | 0.20214007 0.55658787 0.85115793 111 | 0.19364063 0.56061156 0.84668840 112 | 0.18522513 0.56456254 0.84215514 113 | 0.17689199 0.56844254 0.83757133 114 | 0.16864985 0.57225297 0.83294550 115 | 0.16050671 0.57599541 0.82828586 116 | 0.15248942 0.57967111 0.82359259 117 | 0.14460445 0.58328196 0.81887512 118 | 0.13683770 0.58683073 0.81414728 119 | 0.12919576 0.59031956 0.80941474 120 | 0.12176655 0.59374797 0.80466405 121 | 0.11449175 0.59712059 0.79991786 122 | 0.10737245 0.60043994 0.79518181 123 | 0.10050681 0.60370585 0.79044239 124 | 0.09384619 0.60692235 0.78571772 125 | 0.08736971 0.61009287 0.78101439 126 | 0.08123691 0.61321611 0.77631201 127 | 0.07531546 0.61629798 0.77163813 128 | 0.06968968 0.61933947 0.76698178 129 | 0.06439503 0.62234233 0.76234437 130 | 0.05935137 0.62531111 0.75773633 131 | 0.05475166 0.62824432 0.75314075 132 | 0.05038202 0.63114888 0.74857908 133 | 0.04650791 0.63402208 0.74402902 134 | 0.04287424 0.63687089 0.73951208 135 | 0.03972995 0.63969310 0.73500627 136 | 0.03686705 0.64249494 0.73053201 137 | 0.03460089 0.64527403 0.72606522 138 | 0.03257867 0.64803697 0.72162644 139 | 0.03104453 0.65078084 0.71719257 140 | 0.02969367 0.65351152 0.71277950 141 | 0.02864001 0.65622815 0.70837270 142 | 0.02777784 0.65893337 0.70397351 143 | 0.02700031 0.66162969 0.69958382 144 | 0.02646641 0.66431541 0.69518650 145 | 0.02591653 0.66699551 0.69079339 146 | 0.02543955 0.66966922 0.68639301 147 | 0.02502706 0.67233744 0.68197971 148 | 0.02453030 0.67500322 0.67755784 149 | 0.02404979 0.67766552 0.67311544 150 | 0.02355425 0.68032547 0.66864847 151 | 0.02293430 0.68298534 0.66415931 152 | 0.02223750 0.68564487 0.65963932 153 | 0.02154181 0.68830330 0.65507803 154 | 0.02071060 0.69096319 0.65048006 155 | 0.01974871 0.69362490 0.64583967 156 | 0.01875943 0.69628708 0.64114609 157 | 0.01772180 0.69895028 0.63639737 158 | 0.01666524 0.70161458 0.63158433 159 | 0.01576641 0.70427633 0.62670408 160 | 0.01521674 0.70693153 0.62175422 161 | 0.01507406 0.70957945 0.61672894 162 | 0.01530471 0.71222146 0.61162041 163 | 0.01598451 0.71485623 0.60642456 164 | 0.01745609 0.71747624 0.60114468 165 | 0.01956253 0.72008572 0.59576998 166 | 0.02237375 0.72268360 0.59029536 167 | 0.02621618 0.72526278 0.58472478 168 | 0.03102490 0.72782536 0.57904968 169 | 0.03681832 0.73037147 0.57326393 170 | 0.04385110 0.73289239 0.56737467 171 | 0.05132206 0.73539233 0.56137007 172 | 0.05917585 0.73786861 0.55524872 173 | 0.06751253 0.74031459 0.54901561 174 | 0.07607085 0.74273520 0.54265689 175 | 0.08501504 0.74512156 0.53618174 176 | 0.09417995 0.74747651 0.52958098 177 | 0.10359447 0.74979603 0.52285584 178 | 0.11325305 0.75207723 0.51600671 179 | 0.12308410 0.75432084 0.50902606 180 | 0.13315683 0.75652026 0.50192149 181 | 0.14336106 0.75867887 0.49468264 182 | 0.15378729 0.76078849 0.48731905 183 | 0.16432965 0.76285325 0.47981829 184 | 0.17506228 0.76486527 0.47219204 185 | 0.18591093 0.76682750 0.46442797 186 | 0.19691194 0.76873441 0.45653513 187 | 0.20803753 0.77058584 0.44850692 188 | 0.21927420 0.77238048 0.44034386 189 | 0.23064875 0.77411333 0.43205086 190 | 0.24209594 0.77578850 0.42361551 191 | 0.25368840 0.77739605 0.41505448 192 | 0.26534984 0.77894187 0.40635140 193 | 0.27710210 0.78042145 0.39751115 194 | 0.28895035 0.78183184 0.38853679 195 | 0.30085287 0.78317632 0.37941518 196 | 0.31284522 0.78444818 0.37015791 197 | 0.32489625 0.78564963 0.36075448 198 | 0.33698794 0.78678169 0.35119560 199 | 0.34915471 0.78783724 0.34149467 200 | 0.36135547 0.78882103 0.33163114 201 | 0.37359953 0.78973108 0.32157802 202 | 0.38603681 0.79053750 0.31144057 203 | 0.39867099 0.79123531 0.30122187 204 | 0.41149447 0.79182030 0.29095004 205 | 0.42450085 0.79228794 0.28066211 206 | 0.43768733 0.79263245 0.27041698 207 | 0.45103394 0.79285216 0.26025637 208 | 0.46451532 0.79294682 0.25022837 209 | 0.47810681 0.79291621 0.24040230 210 | 0.49178271 0.79276110 0.23085308 211 | 0.50550530 0.79248541 0.22167179 212 | 0.51923946 0.79209383 0.21295105 213 | 0.53294320 0.79159378 0.20479265 214 | 0.54657604 0.79099388 0.19729796 215 | 0.56009629 0.79030455 0.19056714 216 | 0.57346497 0.78953711 0.18469209 217 | 0.58664703 0.78870340 0.17975109 218 | 0.59961196 0.78781544 0.17580392 219 | 0.61233540 0.78688471 0.17288710 220 | 0.62479757 0.78592236 0.17101217 221 | 0.63698725 0.78493782 0.17016375 222 | 0.64889609 0.78394005 0.17030341 223 | 0.66051919 0.78293726 0.17137217 224 | 0.67185960 0.78193531 0.17329509 225 | 0.68292134 0.78093959 0.17598784 226 | 0.69371587 0.77995168 0.17941084 227 | 0.70424813 0.77897648 0.18345860 228 | 0.71452554 0.77801811 0.18801735 229 | 0.72456448 0.77707525 0.19305709 230 | 0.73437395 0.77614993 0.19850495 231 | 0.74396280 0.77524492 0.20425646 232 | 0.75334787 0.77435622 0.21034234 233 | 0.76253421 0.77348882 0.21661791 234 | 0.77153828 0.77263746 0.22314237 235 | 0.78036417 0.77180669 0.22979481 236 | 0.78902909 0.77099127 0.23660598 237 | 0.79761680 0.77016302 0.24346011 238 | 0.80615003 0.76932184 0.25011212 239 | 0.81461846 0.76847321 0.25656694 240 | 0.82304909 0.76760599 0.26285505 241 | 0.83141858 0.76673142 0.26896994 242 | 0.83975808 0.76583602 0.27494197 243 | 0.84805537 0.76492591 0.28077091 244 | 0.85631124 0.76400132 0.28646508 245 | 0.86454265 0.76305464 0.29204226 246 | 0.87274751 0.76208712 0.29750756 247 | 0.88092636 0.76109877 0.30286751 248 | 0.88907841 0.76009024 0.30812766 249 | 0.89721106 0.75905801 0.31329799 250 | 0.90532030 0.75800424 0.31838170 251 | 0.91341624 0.75692384 0.32338962 252 | 0.92150840 0.75581174 0.32833169 253 | 0.92957895 0.75467721 0.33320301 254 | 0.93764776 0.75350964 0.33801858 255 | 0.94571029 0.75231120 0.34278011 256 | 0.95377981 0.75107430 0.34749821 257 | 0.96184401 0.74980538 0.35217022 258 | 0.96993807 0.74848418 0.35681680 259 | 0.97821142 0.74702366 0.36151283 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_mry_dark.m: -------------------------------------------------------------------------------- 1 | function colors = kb_mry_dark(ncolors) 2 | 3 | cm = [ 4 | 0.14976882 0.07492048 0.28815177 5 | 0.15575950 0.07517483 0.29374580 6 | 0.16167010 0.07541362 0.29931359 7 | 0.16757777 0.07555673 0.30491429 8 | 0.17349853 0.07558441 0.31055898 9 | 0.17943314 0.07549279 0.31624634 10 | 0.18538434 0.07527487 0.32197697 11 | 0.19135353 0.07492442 0.32775052 12 | 0.19734542 0.07442967 0.33356979 13 | 0.20336233 0.07378062 0.33943566 14 | 0.20940248 0.07297189 0.34534540 15 | 0.21546684 0.07199312 0.35129887 16 | 0.22155893 0.07082823 0.35729843 17 | 0.22768193 0.06945901 0.36334633 18 | 0.23383301 0.06787495 0.36943920 19 | 0.24001454 0.06605403 0.37557866 20 | 0.24622923 0.06396934 0.38176680 21 | 0.25247535 0.06159773 0.38800149 22 | 0.25875317 0.05890670 0.39428254 23 | 0.26506112 0.05586025 0.40060802 24 | 0.27139941 0.05247533 0.40688409 25 | 0.27775159 0.04896990 0.41280242 26 | 0.28411422 0.04536662 0.41833894 27 | 0.29046682 0.04176764 0.42343038 28 | 0.29679811 0.03819082 0.42811149 29 | 0.30309288 0.03486568 0.43236695 30 | 0.30933660 0.03191210 0.43616835 31 | 0.31552511 0.02930542 0.43957738 32 | 0.32164871 0.02711371 0.44257157 33 | 0.32770588 0.02531852 0.44519692 34 | 0.33369486 0.02392617 0.44747252 35 | 0.33961648 0.02292874 0.44942335 36 | 0.34547317 0.02231120 0.45107529 37 | 0.35126932 0.02203337 0.45247184 38 | 0.35700481 0.02212380 0.45359874 39 | 0.36268969 0.02249801 0.45452329 40 | 0.36832460 0.02315980 0.45525050 41 | 0.37391451 0.02410664 0.45577744 42 | 0.37946596 0.02527810 0.45615225 43 | 0.38498248 0.02665720 0.45638783 44 | 0.39046773 0.02822663 0.45649582 45 | 0.39592522 0.02999181 0.45646514 46 | 0.40135930 0.03191113 0.45632727 47 | 0.40677385 0.03396446 0.45609304 48 | 0.41217134 0.03613816 0.45577091 49 | 0.41755517 0.03841711 0.45536692 50 | 0.42292839 0.04078072 0.45488660 51 | 0.42829344 0.04313593 0.45433551 52 | 0.43365147 0.04547755 0.45372073 53 | 0.43900660 0.04779262 0.45304319 54 | 0.44435867 0.05007734 0.45231090 55 | 0.44971157 0.05232188 0.45152358 56 | 0.45506505 0.05452444 0.45068817 57 | 0.46042251 0.05667790 0.44980400 58 | 0.46578388 0.05878137 0.44887660 59 | 0.47115104 0.06083128 0.44790716 60 | 0.47652576 0.06282913 0.44689047 61 | 0.48190868 0.06477846 0.44582263 62 | 0.48729996 0.06667047 0.44471863 63 | 0.49270166 0.06850224 0.44357759 64 | 0.49811449 0.07027311 0.44240113 65 | 0.50353909 0.07198260 0.44119066 66 | 0.50897638 0.07363549 0.43993814 67 | 0.51442732 0.07523598 0.43863529 68 | 0.51989184 0.07677380 0.43730080 69 | 0.52537045 0.07824870 0.43593537 70 | 0.53086358 0.07966060 0.43453978 71 | 0.53637321 0.08102183 0.43308607 72 | 0.54189861 0.08232111 0.43159784 73 | 0.54743983 0.08355636 0.43008015 74 | 0.55299717 0.08472807 0.42853223 75 | 0.55857340 0.08584849 0.42691965 76 | 0.56416640 0.08690383 0.42527796 77 | 0.56977629 0.08789406 0.42360750 78 | 0.57540507 0.08882650 0.42188498 79 | 0.58105169 0.08969928 0.42011920 80 | 0.58671582 0.09050555 0.41832466 81 | 0.59239927 0.09124940 0.41648349 82 | 0.59810296 0.09193175 0.41458788 83 | 0.60382295 0.09254856 0.41266716 84 | 0.60956624 0.09309450 0.41069001 85 | 0.61530612 0.09363381 0.40868885 86 | 0.62106728 0.09410787 0.40663067 87 | 0.62683657 0.09455377 0.40452073 88 | 0.63260960 0.09498330 0.40236264 89 | 0.63840054 0.09535723 0.40014537 90 | 0.64419947 0.09570353 0.39787406 91 | 0.64999673 0.09605106 0.39555251 92 | 0.65580871 0.09635295 0.39316899 93 | 0.66163386 0.09661332 0.39072328 94 | 0.66744645 0.09690797 0.38823224 95 | 0.67326929 0.09717101 0.38567818 96 | 0.67910157 0.09740499 0.38306003 97 | 0.68493396 0.09763830 0.38038306 98 | 0.69075777 0.09789839 0.37765246 99 | 0.69658689 0.09814408 0.37485634 100 | 0.70241968 0.09838091 0.37199424 101 | 0.70824855 0.09863333 0.36907055 102 | 0.71406327 0.09893483 0.36609178 103 | 0.71987699 0.09924555 0.36304614 104 | 0.72568790 0.09957230 0.35993324 105 | 0.73149397 0.09992266 0.35675329 106 | 0.73728375 0.10033506 0.35351423 107 | 0.74305734 0.10081102 0.35021460 108 | 0.74882047 0.10133343 0.34684818 109 | 0.75457091 0.10191103 0.34341531 110 | 0.76030648 0.10255253 0.33991585 111 | 0.76602559 0.10326552 0.33634720 112 | 0.77172037 0.10407664 0.33271724 113 | 0.77738582 0.10500382 0.32902900 114 | 0.78302753 0.10602984 0.32527479 115 | 0.78864313 0.10716367 0.32145390 116 | 0.79422912 0.10841654 0.31757027 117 | 0.79978323 0.10979672 0.31362228 118 | 0.80530234 0.11131392 0.30961177 119 | 0.81078321 0.11297756 0.30554097 120 | 0.81622327 0.11479523 0.30140855 121 | 0.82161867 0.11677632 0.29721953 122 | 0.82696690 0.11892699 0.29297132 123 | 0.83226398 0.12125527 0.28866948 124 | 0.83750676 0.12376686 0.28431476 125 | 0.84269188 0.12646693 0.27990873 126 | 0.84781553 0.12936032 0.27545627 127 | 0.85287458 0.13245003 0.27095723 128 | 0.85786528 0.13573886 0.26641636 129 | 0.86278403 0.13922836 0.26183768 130 | 0.86762737 0.14291897 0.25722479 131 | 0.87239199 0.14681019 0.25258003 132 | 0.87707439 0.15090057 0.24790931 133 | 0.88167133 0.15518765 0.24321712 134 | 0.88617969 0.15966801 0.23850859 135 | 0.89059654 0.16433738 0.23378896 136 | 0.89491912 0.16919062 0.22906384 137 | 0.89913591 0.17424462 0.22434880 138 | 0.90325071 0.17947623 0.21964379 139 | 0.90726413 0.18487167 0.21495186 140 | 0.91117463 0.19042290 0.21027934 141 | 0.91498102 0.19612142 0.20563266 142 | 0.91868245 0.20195848 0.20101795 143 | 0.92227843 0.20792506 0.19644147 144 | 0.92576809 0.21401356 0.19191018 145 | 0.92914032 0.22023778 0.18744426 146 | 0.93240797 0.22656219 0.18303439 147 | 0.93557199 0.23297768 0.17868606 148 | 0.93863360 0.23947542 0.17440430 149 | 0.94159427 0.24604689 0.17019391 150 | 0.94445568 0.25268395 0.16605935 151 | 0.94721983 0.25937861 0.16200525 152 | 0.94988875 0.26612358 0.15803548 153 | 0.95246148 0.27291851 0.15414182 154 | 0.95497997 0.27969169 0.15027318 155 | 0.95744504 0.28644508 0.14641274 156 | 0.95985560 0.29318236 0.14256077 157 | 0.96220964 0.29990801 0.13872235 158 | 0.96450527 0.30662590 0.13490377 159 | 0.96674059 0.31333960 0.13111209 160 | 0.96891354 0.32005258 0.12735503 161 | 0.97102248 0.32676734 0.12364259 162 | 0.97306107 0.33349184 0.12000804 163 | 0.97502943 0.34022579 0.11645621 164 | 0.97692809 0.34696841 0.11299045 165 | 0.97875536 0.35372146 0.10962675 166 | 0.98050989 0.36048605 0.10638367 167 | 0.98218766 0.36726608 0.10329693 168 | 0.98378382 0.37406593 0.10041240 169 | 0.98530292 0.38087996 0.09772067 170 | 0.98674406 0.38770832 0.09524858 171 | 0.98810654 0.39455090 0.09302468 172 | 0.98938130 0.40141567 0.09113407 173 | 0.99057427 0.40829566 0.08956632 174 | 0.99168674 0.41518868 0.08833986 175 | 0.99271871 0.42209380 0.08748282 176 | 0.99366189 0.42901760 0.08707899 177 | 0.99452212 0.43595360 0.08711223 178 | 0.99530240 0.44289817 0.08758163 179 | 0.99600343 0.44984987 0.08849880 180 | 0.99661631 0.45681541 0.08993604 181 | 0.99714984 0.46378630 0.09183817 182 | 0.99760692 0.47075943 0.09418684 183 | 0.99798872 0.47773324 0.09697079 184 | 0.99828645 0.48471409 0.10023996 185 | 0.99851075 0.49169281 0.10391478 186 | 0.99866428 0.49866697 0.10796624 187 | 0.99874861 0.50563507 0.11237180 188 | 0.99875782 0.51260116 0.11715263 189 | 0.99869839 0.51956009 0.12225556 190 | 0.99857530 0.52650811 0.12763998 191 | 0.99839045 0.53344386 0.13328459 192 | 0.99814528 0.54036642 0.13916967 193 | 0.99783266 0.54728058 0.14532269 194 | 0.99746366 0.55417893 0.15167661 195 | 0.99704024 0.56106038 0.15821563 196 | 0.99656405 0.56792416 0.16492575 197 | 0.99603680 0.57476950 0.17179419 198 | 0.99546009 0.58159574 0.17881029 199 | 0.99482922 0.58840605 0.18599042 200 | 0.99415281 0.59519557 0.19329407 201 | 0.99343230 0.60196394 0.20071298 202 | 0.99266918 0.60871079 0.20823965 203 | 0.99186482 0.61543587 0.21586735 204 | 0.99102106 0.62213865 0.22358957 205 | 0.99013954 0.62881875 0.23140044 206 | 0.98922150 0.63547611 0.23929500 207 | 0.98825449 0.64211931 0.24728187 208 | 0.98725532 0.64874149 0.25526753 209 | 0.98622740 0.65534181 0.26323974 210 | 0.98517271 0.66191951 0.27120709 211 | 0.98408938 0.66847650 0.27917419 212 | 0.98297722 0.67501341 0.28714721 213 | 0.98183578 0.68153101 0.29513230 214 | 0.98066531 0.68802961 0.30313471 215 | 0.97946560 0.69450974 0.31115991 216 | 0.97823812 0.70097092 0.31921298 217 | 0.97699217 0.70740806 0.32729899 218 | 0.97571645 0.71382819 0.33542458 219 | 0.97441306 0.72023049 0.34359275 220 | 0.97308254 0.72661491 0.35180863 221 | 0.97173911 0.73297368 0.36007887 222 | 0.97036873 0.73931513 0.36840751 223 | 0.96897065 0.74563981 0.37680047 224 | 0.96756733 0.75193578 0.38526235 225 | 0.96613756 0.75821478 0.39380041 226 | 0.96469500 0.76446975 0.40241902 227 | 0.96324188 0.77069982 0.41112442 228 | 0.96177572 0.77690650 0.41992339 229 | 0.96030633 0.78308493 0.42882304 230 | 0.95883257 0.78923596 0.43783064 231 | 0.95735699 0.79535855 0.44695288 232 | 0.95589811 0.80144383 0.45619695 233 | 0.95444651 0.80749673 0.46557151 234 | 0.95301110 0.81351310 0.47508612 235 | 0.95161533 0.81948214 0.48474824 236 | 0.95025753 0.82540514 0.49456738 237 | 0.94895027 0.83127669 0.50455276 238 | 0.94770891 0.83709025 0.51471341 239 | 0.94655111 0.84283854 0.52505757 240 | 0.94549752 0.84851324 0.53559155 241 | 0.94456994 0.85410576 0.54632212 242 | 0.94380205 0.85960287 0.55725044 243 | 0.94322996 0.86499097 0.56837350 244 | 0.94287867 0.87026206 0.57968236 245 | 0.94280113 0.87539675 0.59116112 246 | 0.94303538 0.88038340 0.60278137 247 | 0.94360792 0.88521599 0.61450786 248 | 0.94427836 0.89000704 0.62622683 249 | 0.94498237 0.89478863 0.63788446 250 | 0.94571644 0.89956195 0.64949381 251 | 0.94648247 0.90432688 0.66105487 252 | 0.94728371 0.90908297 0.67256441 253 | 0.94812004 0.91383057 0.68402729 254 | 0.94899322 0.91856957 0.69544389 255 | 0.94990243 0.92330041 0.70682085 256 | 0.95085224 0.92802235 0.71815204 257 | 0.95184021 0.93273613 0.72944824 258 | 0.95286059 0.93744310 0.74072850 259 | 0.95386116 0.94215368 0.75212492 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end 265 | -------------------------------------------------------------------------------- /code/matlab/colors/kb_mry_light.m: -------------------------------------------------------------------------------- 1 | function colors = kb_mry_light(ncolors) 2 | 3 | cm = [ 4 | 0.33029058 0.34194727 0.56025995 5 | 0.33579762 0.34208080 0.56483952 6 | 0.34118154 0.34223852 0.56939821 7 | 0.34654790 0.34236811 0.57400562 8 | 0.35190490 0.34246567 0.57866493 9 | 0.35726585 0.34252410 0.58338380 10 | 0.36263291 0.34254201 0.58816191 11 | 0.36800368 0.34252062 0.59299538 12 | 0.37338918 0.34245321 0.59789120 13 | 0.37878934 0.34233930 0.60284774 14 | 0.38420354 0.34217871 0.60786293 15 | 0.38963498 0.34196886 0.61293794 16 | 0.39508422 0.34170867 0.61807184 17 | 0.40055851 0.34139264 0.62326963 18 | 0.40605641 0.34102064 0.62852897 19 | 0.41157455 0.34059393 0.63384568 20 | 0.41712067 0.34010612 0.63922565 21 | 0.42269441 0.33955612 0.64466767 22 | 0.42829322 0.33894439 0.65016845 23 | 0.43392348 0.33826486 0.65573313 24 | 0.43958419 0.33751657 0.66136006 25 | 0.44527132 0.33670090 0.66704466 26 | 0.45099843 0.33580554 0.67279940 27 | 0.45675360 0.33483766 0.67861219 28 | 0.46253856 0.33379395 0.68448414 29 | 0.46836698 0.33266087 0.69042833 30 | 0.47422783 0.33144489 0.69643350 31 | 0.48011488 0.33016924 0.70240940 32 | 0.48605814 0.32882779 0.70829785 33 | 0.49205635 0.32742735 0.71406692 34 | 0.49810795 0.32596472 0.71972644 35 | 0.50421043 0.32444064 0.72527274 36 | 0.51036049 0.32285918 0.73069197 37 | 0.51654971 0.32123548 0.73594337 38 | 0.52277798 0.31956218 0.74105119 39 | 0.52904174 0.31784301 0.74600669 40 | 0.53532938 0.31610028 0.75075740 41 | 0.54164177 0.31432510 0.75533244 42 | 0.54797335 0.31252299 0.75972639 43 | 0.55431219 0.31072004 0.76388204 44 | 0.56065905 0.30890474 0.76784013 45 | 0.56700703 0.30708861 0.77158326 46 | 0.57334588 0.30529217 0.77507629 47 | 0.57967614 0.30350607 0.77835477 48 | 0.58598836 0.30174960 0.78138869 49 | 0.59227750 0.30003043 0.78417586 50 | 0.59854248 0.29834445 0.78674077 51 | 0.60477291 0.29671675 0.78904346 52 | 0.61096879 0.29514128 0.79111303 53 | 0.61712871 0.29361811 0.79296281 54 | 0.62324170 0.29217541 0.79454969 55 | 0.62931262 0.29079631 0.79592119 56 | 0.63533904 0.28948411 0.79708428 57 | 0.64131353 0.28826197 0.79800308 58 | 0.64723968 0.28711466 0.79872193 59 | 0.65311841 0.28604131 0.79924969 60 | 0.65894555 0.28505452 0.79957177 61 | 0.66472116 0.28415331 0.79970000 62 | 0.67044905 0.28332806 0.79965827 63 | 0.67612970 0.28257852 0.79945320 64 | 0.68176126 0.28191252 0.79907561 65 | 0.68734474 0.28132771 0.79853598 66 | 0.69288409 0.28081436 0.79785516 67 | 0.69838092 0.28037037 0.79703932 68 | 0.70383647 0.27999379 0.79609491 69 | 0.70925228 0.27968270 0.79502686 70 | 0.71462748 0.27944343 0.79382487 71 | 0.71996669 0.27926284 0.79251396 72 | 0.72527201 0.27913782 0.79109910 73 | 0.73054510 0.27906556 0.78958557 74 | 0.73578711 0.27904359 0.78797912 75 | 0.74100067 0.27906824 0.78628335 76 | 0.74618741 0.27913658 0.78450284 77 | 0.75134934 0.27924541 0.78264144 78 | 0.75648748 0.27939230 0.78070414 79 | 0.76160403 0.27957389 0.77869398 80 | 0.76670133 0.27978674 0.77661339 81 | 0.77177928 0.28002935 0.77446843 82 | 0.77684230 0.28029668 0.77225754 83 | 0.78184265 0.28066653 0.76994592 84 | 0.78677477 0.28115871 0.76750215 85 | 0.79163407 0.28178001 0.76492836 86 | 0.79641809 0.28253530 0.76222321 87 | 0.80112190 0.28343073 0.75939117 88 | 0.80574202 0.28447088 0.75643476 89 | 0.81027560 0.28565938 0.75335594 90 | 0.81471882 0.28699985 0.75016022 91 | 0.81906869 0.28849468 0.74685233 92 | 0.82332252 0.29014538 0.74343761 93 | 0.82747238 0.29196160 0.73991821 94 | 0.83151947 0.29393732 0.73630397 95 | 0.83546390 0.29606838 0.73260329 96 | 0.83930444 0.29835243 0.72882391 97 | 0.84304028 0.30078628 0.72497405 98 | 0.84667102 0.30336590 0.72106221 99 | 0.85019672 0.30608652 0.71709683 100 | 0.85361787 0.30894276 0.71308632 101 | 0.85693526 0.31192852 0.70904005 102 | 0.86015025 0.31503741 0.70496581 103 | 0.86326453 0.31826263 0.70087152 104 | 0.86628008 0.32159714 0.69676485 105 | 0.86919912 0.32503335 0.69265493 106 | 0.87202436 0.32856426 0.68854688 107 | 0.87475859 0.33218261 0.68444702 108 | 0.87740480 0.33588052 0.68036401 109 | 0.87996622 0.33965159 0.67630028 110 | 0.88244616 0.34348843 0.67226266 111 | 0.88484804 0.34738449 0.66825509 112 | 0.88717531 0.35133356 0.66428074 113 | 0.88943158 0.35532896 0.66034504 114 | 0.89162026 0.35936554 0.65644871 115 | 0.89374499 0.36343731 0.65259602 116 | 0.89580924 0.36753928 0.64878850 117 | 0.89781633 0.37166702 0.64502675 118 | 0.89977000 0.37581505 0.64131508 119 | 0.90167319 0.37998030 0.63765128 120 | 0.90352927 0.38415855 0.63403714 121 | 0.90533036 0.38835907 0.63047073 122 | 0.90708598 0.39257099 0.62695234 123 | 0.90880264 0.39678688 0.62348397 124 | 0.91048332 0.40100378 0.62006579 125 | 0.91213122 0.40521833 0.61669946 126 | 0.91374863 0.40942908 0.61338202 127 | 0.91533081 0.41364206 0.61011036 128 | 0.91687289 0.41786317 0.60688133 129 | 0.91839129 0.42207482 0.60369940 130 | 0.91988838 0.42627536 0.60056358 131 | 0.92136642 0.43046334 0.59747275 132 | 0.92281323 0.43465257 0.59442106 133 | 0.92423293 0.43883928 0.59140816 134 | 0.92563908 0.44301009 0.58843658 135 | 0.92703362 0.44716406 0.58550494 136 | 0.92840387 0.45131502 0.58260743 137 | 0.92975080 0.45546258 0.57974262 138 | 0.93109070 0.45959122 0.57691347 139 | 0.93242517 0.46370043 0.57411845 140 | 0.93372761 0.46781703 0.57134780 141 | 0.93502361 0.47191645 0.56860877 142 | 0.93631815 0.47599503 0.56589997 143 | 0.93759315 0.48007089 0.56321364 144 | 0.93885384 0.48413963 0.56054973 145 | 0.94011601 0.48818723 0.55791067 146 | 0.94136519 0.49222748 0.55529402 147 | 0.94259869 0.49626387 0.55269384 148 | 0.94383625 0.50027908 0.55011366 149 | 0.94505916 0.50429053 0.54754839 150 | 0.94627156 0.50829486 0.54499856 151 | 0.94749022 0.51227814 0.54246453 152 | 0.94868727 0.51626537 0.53993857 153 | 0.94988314 0.52023896 0.53742577 154 | 0.95108367 0.52419485 0.53492350 155 | 0.95225655 0.52816111 0.53242293 156 | 0.95344487 0.53210346 0.52991578 157 | 0.95464427 0.53602592 0.52740310 158 | 0.95585216 0.53993143 0.52488232 159 | 0.95706764 0.54382351 0.52233156 160 | 0.95829153 0.54769814 0.51978595 161 | 0.95952064 0.55156118 0.51721830 162 | 0.96075448 0.55541421 0.51462005 163 | 0.96199401 0.55925237 0.51203406 164 | 0.96323511 0.56308360 0.50941742 165 | 0.96447770 0.56690817 0.50677018 166 | 0.96572238 0.57072165 0.50413452 167 | 0.96696640 0.57453019 0.50147226 168 | 0.96820769 0.57833601 0.49877807 169 | 0.96944651 0.58213589 0.49608501 170 | 0.97068129 0.58593290 0.49337527 171 | 0.97191041 0.58972935 0.49063817 172 | 0.97313283 0.59352509 0.48788437 173 | 0.97434773 0.59731896 0.48513467 174 | 0.97555292 0.60111524 0.48236032 175 | 0.97674696 0.60491487 0.47956247 176 | 0.97792876 0.60871752 0.47675408 177 | 0.97909719 0.61252286 0.47394886 178 | 0.98025027 0.61633420 0.47112467 179 | 0.98138657 0.62015236 0.46828361 180 | 0.98250460 0.62397810 0.46542795 181 | 0.98360318 0.62781068 0.46257662 182 | 0.98468058 0.63165155 0.45972587 183 | 0.98573503 0.63550258 0.45686687 184 | 0.98676461 0.63936482 0.45400166 185 | 0.98776690 0.64323968 0.45113136 186 | 0.98874120 0.64712702 0.44826240 187 | 0.98968580 0.65102756 0.44539864 188 | 0.99059644 0.65494397 0.44253996 189 | 0.99147344 0.65887467 0.43970277 190 | 0.99231319 0.66282262 0.43687670 191 | 0.99311366 0.66678855 0.43406701 192 | 0.99387166 0.67077408 0.43127675 193 | 0.99458563 0.67477939 0.42851382 194 | 0.99524984 0.67880798 0.42577699 195 | 0.99586301 0.68285960 0.42307683 196 | 0.99642118 0.68693586 0.42042177 197 | 0.99692029 0.69103769 0.41783077 198 | 0.99735494 0.69516843 0.41529872 199 | 0.99772051 0.69932988 0.41283468 200 | 0.99801092 0.70352476 0.41044684 201 | 0.99822031 0.70775539 0.40814596 202 | 0.99834167 0.71202252 0.40597835 203 | 0.99836507 0.71633159 0.40394217 204 | 0.99828273 0.72068633 0.40203908 205 | 0.99808349 0.72508761 0.40034985 206 | 0.99775362 0.72954389 0.39885131 207 | 0.99728064 0.73405592 0.39763414 208 | 0.99664573 0.73863334 0.39669640 209 | 0.99583211 0.74327760 0.39615171 210 | 0.99481805 0.74799603 0.39605563 211 | 0.99358147 0.75279372 0.39649790 212 | 0.99210037 0.75767342 0.39760088 213 | 0.99035532 0.76263498 0.39950329 214 | 0.98834239 0.76766744 0.40237568 215 | 0.98607982 0.77274697 0.40640021 216 | 0.98363280 0.77783858 0.41151356 217 | 0.98111264 0.78290885 0.41721860 218 | 0.97854047 0.78794784 0.42347786 219 | 0.97594204 0.79294010 0.43031743 220 | 0.97335238 0.79786646 0.43775346 221 | 0.97081413 0.80270558 0.44578568 222 | 0.96837447 0.80743623 0.45438586 223 | 0.96608189 0.81203876 0.46350343 224 | 0.96398283 0.81649637 0.47307114 225 | 0.96211613 0.82079753 0.48300852 226 | 0.96050921 0.82493700 0.49323112 227 | 0.95917819 0.82891521 0.50365551 228 | 0.95812693 0.83273793 0.51420789 229 | 0.95735573 0.83641101 0.52483877 230 | 0.95685238 0.83994648 0.53549095 231 | 0.95660360 0.84335521 0.54612904 232 | 0.95659382 0.84664841 0.55672433 233 | 0.95680978 0.84983485 0.56726559 234 | 0.95723171 0.85292686 0.57772867 235 | 0.95784554 0.85593284 0.58810612 236 | 0.95863748 0.85886062 0.59839376 237 | 0.95959471 0.86171740 0.60858798 238 | 0.96070495 0.86450980 0.61868756 239 | 0.96195699 0.86724385 0.62869101 240 | 0.96334034 0.86992510 0.63859790 241 | 0.96484530 0.87255859 0.64840800 242 | 0.96641658 0.87516358 0.65819844 243 | 0.96800299 0.87776638 0.66792760 244 | 0.96960495 0.88036724 0.67759371 245 | 0.97122126 0.88296634 0.68720480 246 | 0.97285205 0.88556392 0.69676065 247 | 0.97449710 0.88816020 0.70626282 248 | 0.97615780 0.89075552 0.71570302 249 | 0.97783232 0.89335001 0.72509258 250 | 0.97951965 0.89594384 0.73443760 251 | 0.98122330 0.89853757 0.74371615 252 | 0.98293958 0.90113117 0.75295057 253 | 0.98466949 0.90372502 0.76213406 254 | 0.98641283 0.90631940 0.77126695 255 | 0.98816787 0.90891446 0.78035862 256 | 0.98993575 0.91151067 0.78940057 257 | 0.99171465 0.91410820 0.79840211 258 | 0.99350114 0.91670704 0.80738161 259 | 0.99527089 0.91930451 0.81648383 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/kb_mrygc.m: -------------------------------------------------------------------------------- 1 | function colors = kb_mrygc(ncolors) 2 | 3 | cm = [ 4 | 0.67845062 0.14226933 0.83171098 5 | 0.68182344 0.14885409 0.82341719 6 | 0.68519872 0.15465076 0.81574532 7 | 0.68863220 0.15989845 0.80830209 8 | 0.69212422 0.16466937 0.80105946 9 | 0.69568041 0.16902499 0.79396767 10 | 0.69929763 0.17300425 0.78702650 11 | 0.70297320 0.17664084 0.78023296 12 | 0.70671381 0.17996805 0.77354305 13 | 0.71051205 0.18300582 0.76697788 14 | 0.71436357 0.18577471 0.76054232 15 | 0.71828150 0.18829542 0.75417200 16 | 0.72224963 0.19058048 0.74792094 17 | 0.72627617 0.19264420 0.74174669 18 | 0.73036175 0.19449721 0.73563818 19 | 0.73449869 0.19615040 0.72961360 20 | 0.73868794 0.19761274 0.72365992 21 | 0.74293436 0.19889009 0.71775225 22 | 0.74723640 0.19998876 0.71188821 23 | 0.75159048 0.20091547 0.70607133 24 | 0.75599573 0.20167540 0.70029639 25 | 0.76045156 0.20227285 0.69455733 26 | 0.76495811 0.20271099 0.68884630 27 | 0.76951485 0.20299272 0.68315765 28 | 0.77412117 0.20312041 0.67748608 29 | 0.77877560 0.20309659 0.67182890 30 | 0.78347811 0.20292224 0.66617943 31 | 0.78822808 0.20259823 0.66053285 32 | 0.79302332 0.20212640 0.65488859 33 | 0.79786418 0.20150597 0.64923946 34 | 0.80275128 0.20073523 0.64357787 35 | 0.80768783 0.19980915 0.63788989 36 | 0.81266635 0.19873301 0.63218900 37 | 0.81768626 0.19750501 0.62647093 38 | 0.82274665 0.19612322 0.62073243 39 | 0.82784612 0.19458579 0.61497163 40 | 0.83298834 0.19288405 0.60917430 41 | 0.83817599 0.19100929 0.60332915 42 | 0.84339970 0.18896744 0.59745419 43 | 0.84865806 0.18675432 0.59154803 44 | 0.85394968 0.18436502 0.58560936 45 | 0.85929045 0.18176823 0.57959581 46 | 0.86466301 0.17897912 0.57354472 47 | 0.87006541 0.17599068 0.56745658 48 | 0.87550041 0.17278700 0.56132079 49 | 0.88097981 0.16933403 0.55510553 50 | 0.88639894 0.16588904 0.54885546 51 | 0.89178113 0.16243065 0.54247412 52 | 0.89707423 0.15910819 0.53597793 53 | 0.90229320 0.15589124 0.52936194 54 | 0.90745580 0.15273745 0.52261810 55 | 0.91255408 0.14967808 0.51574840 56 | 0.91754923 0.14684436 0.50876893 57 | 0.92243863 0.14426333 0.50168161 58 | 0.92724208 0.14188944 0.49447683 59 | 0.93195023 0.13976786 0.48716081 60 | 0.93655384 0.13794560 0.47973988 61 | 0.94103833 0.13648950 0.47222379 62 | 0.94536728 0.13554574 0.46463193 63 | 0.94956731 0.13503565 0.45695716 64 | 0.95362912 0.13500172 0.44920947 65 | 0.95754382 0.13548116 0.44139842 66 | 0.96130208 0.13650526 0.43353879 67 | 0.96489575 0.13809601 0.42564205 68 | 0.96831671 0.14026626 0.41772387 69 | 0.97155771 0.14301836 0.40980025 70 | 0.97461250 0.14634453 0.40188576 71 | 0.97747557 0.15022689 0.39399920 72 | 0.98013743 0.15465601 0.38616084 73 | 0.98259344 0.15960212 0.37838880 74 | 0.98484944 0.16500078 0.37069608 75 | 0.98690478 0.17081006 0.36309944 76 | 0.98876018 0.17698580 0.35561459 77 | 0.99041776 0.18348285 0.34825646 78 | 0.99188094 0.19025670 0.34103796 79 | 0.99315426 0.19726446 0.33396999 80 | 0.99424342 0.20446507 0.32706237 81 | 0.99515510 0.21182010 0.32032299 82 | 0.99589636 0.21929547 0.31375602 83 | 0.99647547 0.22685820 0.30736682 84 | 0.99690042 0.23448099 0.30115566 85 | 0.99718010 0.24213778 0.29512383 86 | 0.99732299 0.24980719 0.28926905 87 | 0.99730450 0.25753344 0.28361649 88 | 0.99716256 0.26524006 0.27813751 89 | 0.99690708 0.27290974 0.27282835 90 | 0.99654662 0.28052995 0.26768399 91 | 0.99608882 0.28809148 0.26269713 92 | 0.99554161 0.29558555 0.25786148 93 | 0.99485993 0.30308845 0.25321289 94 | 0.99409968 0.31051234 0.24870596 95 | 0.99326902 0.31785057 0.24433248 96 | 0.99237468 0.32509932 0.24008494 97 | 0.99138090 0.33231545 0.23599114 98 | 0.99030925 0.33947078 0.23203124 99 | 0.98918927 0.34652918 0.22817778 100 | 0.98802606 0.35349016 0.22442406 101 | 0.98674933 0.36044999 0.22082889 102 | 0.98543860 0.36730817 0.21732278 103 | 0.98409720 0.37406700 0.21389641 104 | 0.98266242 0.38080725 0.21060424 105 | 0.98118859 0.38746557 0.20739869 106 | 0.97969419 0.39402563 0.20425482 107 | 0.97810706 0.40057324 0.20124316 108 | 0.97649266 0.40703701 0.19829460 109 | 0.97485751 0.41341383 0.19540741 110 | 0.97312926 0.41978468 0.19264097 111 | 0.97139752 0.42605632 0.18991467 112 | 0.96960722 0.43228966 0.18727497 113 | 0.96776962 0.43847500 0.18470862 114 | 0.96592722 0.44457260 0.18217803 115 | 0.96399077 0.45067209 0.17976384 116 | 0.96206023 0.45667885 0.17736633 117 | 0.96005803 0.46266848 0.17506274 118 | 0.95803604 0.46859420 0.17280098 119 | 0.95597481 0.47447602 0.17059624 120 | 0.95386209 0.48032619 0.16846010 121 | 0.95173712 0.48611194 0.16635077 122 | 0.94953649 0.49188929 0.16433334 123 | 0.94734450 0.49758805 0.16231815 124 | 0.94505829 0.50329528 0.16041315 125 | 0.94279290 0.50891761 0.15849460 126 | 0.94042616 0.51455484 0.15669325 127 | 0.93807962 0.52011124 0.15487585 128 | 0.93563749 0.52567842 0.15316775 129 | 0.93321115 0.53117145 0.15144629 130 | 0.93069035 0.53667471 0.14983233 131 | 0.92818540 0.54210674 0.14820184 132 | 0.92558179 0.54755224 0.14668252 133 | 0.92299913 0.55292552 0.14513801 134 | 0.92030871 0.55831865 0.14371395 135 | 0.91763761 0.56364313 0.14226354 136 | 0.91486775 0.56898097 0.14092181 137 | 0.91207524 0.57428189 0.13954851 138 | 0.90925772 0.57954438 0.13828647 139 | 0.90638139 0.58479621 0.13699737 140 | 0.90347270 0.59001616 0.13580487 141 | 0.90050773 0.59522322 0.13461332 142 | 0.89750388 0.60040368 0.13351177 143 | 0.89444329 0.60557119 0.13243044 144 | 0.89133944 0.61071535 0.13144262 145 | 0.88817597 0.61584816 0.13048454 146 | 0.88496715 0.62095882 0.12963512 147 | 0.88169314 0.62606144 0.12881354 148 | 0.87837417 0.63114113 0.12812897 149 | 0.87498150 0.63621781 0.12745715 150 | 0.87154696 0.64126877 0.12696558 151 | 0.86802690 0.64632355 0.12645666 152 | 0.86447102 0.65134783 0.12618781 153 | 0.86082193 0.65637941 0.12589645 154 | 0.85712728 0.66138592 0.12583820 155 | 0.85334553 0.66639395 0.12581749 156 | 0.84949904 0.67138821 0.12596165 157 | 0.84557895 0.67637354 0.12624560 158 | 0.84156418 0.68136162 0.12660203 159 | 0.83749313 0.68632819 0.12722366 160 | 0.83331790 0.69130144 0.12789029 161 | 0.82906922 0.69626117 0.12879784 162 | 0.82472918 0.70121733 0.12985875 163 | 0.82027781 0.70617972 0.13101118 164 | 0.81576154 0.71112043 0.13250155 165 | 0.81112641 0.71606865 0.13409481 166 | 0.80638155 0.72101741 0.13586029 167 | 0.80155023 0.72595219 0.13794112 168 | 0.79659269 0.73089311 0.14016409 169 | 0.79150893 0.73583757 0.14257706 170 | 0.78633158 0.74076678 0.14534549 171 | 0.78101646 0.74570168 0.14829702 172 | 0.77555959 0.75064169 0.15144907 173 | 0.76998646 0.75557173 0.15493897 174 | 0.76427749 0.76049912 0.15871708 175 | 0.75841506 0.76542979 0.16273824 176 | 0.75239633 0.77036223 0.16702058 177 | 0.74623406 0.77528769 0.17164065 178 | 0.73993059 0.78020261 0.17662552 179 | 0.73346268 0.78511472 0.18191252 180 | 0.72682958 0.79002141 0.18751896 181 | 0.72002870 0.79492060 0.19346307 182 | 0.71306125 0.79980887 0.19976144 183 | 0.70593128 0.80468187 0.20642893 184 | 0.69865591 0.80952988 0.21352684 185 | 0.69122706 0.81435412 0.22101850 186 | 0.68365021 0.81915035 0.22890761 187 | 0.67593391 0.82391325 0.23720631 188 | 0.66809566 0.82863520 0.24592089 189 | 0.66015507 0.83330846 0.25505572 190 | 0.65213589 0.83792468 0.26461195 191 | 0.64406700 0.84247476 0.27458645 192 | 0.63598265 0.84694904 0.28497139 193 | 0.62792224 0.85133745 0.29575390 194 | 0.61993138 0.85562927 0.30692036 195 | 0.61208067 0.85980765 0.31847893 196 | 0.60440186 0.86386948 0.33036654 197 | 0.59694751 0.86780617 0.34254974 198 | 0.58977071 0.87161021 0.35499132 199 | 0.58292272 0.87527548 0.36765215 200 | 0.57645121 0.87879751 0.38049258 201 | 0.57039929 0.88217345 0.39347308 202 | 0.56480459 0.88540208 0.40655484 203 | 0.55969793 0.88848377 0.41970133 204 | 0.55510240 0.89142044 0.43287983 205 | 0.55103444 0.89421520 0.44606007 206 | 0.54750364 0.89687218 0.45921501 207 | 0.54451412 0.89939622 0.47231848 208 | 0.54206241 0.90179301 0.48535092 209 | 0.54013998 0.90406861 0.49829598 210 | 0.53873450 0.90622929 0.51113858 211 | 0.53783117 0.90828151 0.52386091 212 | 0.53740910 0.91023178 0.53645851 213 | 0.53744825 0.91208670 0.54891453 214 | 0.53792412 0.91385259 0.56122647 215 | 0.53886728 0.91552227 0.57342709 216 | 0.54022528 0.91710870 0.58548477 217 | 0.54195112 0.91862269 0.59738230 218 | 0.54401805 0.92007008 0.60911575 219 | 0.54637829 0.92145362 0.62078923 220 | 0.54879980 0.92282767 0.63228712 221 | 0.55127895 0.92419226 0.64362725 222 | 0.55381204 0.92554760 0.65482402 223 | 0.55639467 0.92689480 0.66588001 224 | 0.55902207 0.92823519 0.67679616 225 | 0.56168896 0.92957038 0.68757030 226 | 0.56438848 0.93090358 0.69818422 227 | 0.56711704 0.93223388 0.70866606 228 | 0.56986862 0.93356308 0.71901378 229 | 0.57263767 0.93489226 0.72923374 230 | 0.57541764 0.93622338 0.73932340 231 | 0.57820245 0.93755772 0.74928811 232 | 0.58098552 0.93889694 0.75912982 233 | 0.58376002 0.94024278 0.76885000 234 | 0.58651918 0.94159681 0.77845235 235 | 0.58925612 0.94296060 0.78794083 236 | 0.59196386 0.94433574 0.79731969 237 | 0.59463537 0.94572378 0.80659350 238 | 0.59726358 0.94712626 0.81576715 239 | 0.59984143 0.94854470 0.82484587 240 | 0.60236199 0.94998035 0.83383735 241 | 0.60481828 0.95143454 0.84274838 242 | 0.60720332 0.95290861 0.85158563 243 | 0.60950963 0.95440622 0.86033101 244 | 0.61173176 0.95592588 0.86901875 245 | 0.61386307 0.95746836 0.87766011 246 | 0.61589729 0.95903634 0.88624430 247 | 0.61782891 0.96063065 0.89477931 248 | 0.61965134 0.96224993 0.90329771 249 | 0.62136137 0.96389828 0.91176656 250 | 0.62295146 0.96557283 0.92023555 251 | 0.62441790 0.96727544 0.92869546 252 | 0.62575794 0.96900719 0.93714284 253 | 0.62696525 0.97076685 0.94560552 254 | 0.62803550 0.97255449 0.95409280 255 | 0.62896602 0.97437044 0.96260701 256 | 0.62975137 0.97621400 0.97116651 257 | 0.63038514 0.97808442 0.97979111 258 | 0.63086209 0.97998134 0.98849362 259 | 0.63110260 0.98189458 0.99754106 260 | ]; 261 | cmsize = size(cm, 1); 262 | colors = interp1(1:cmsize, cm, linspace(1, cmsize, ncolors)); 263 | 264 | end -------------------------------------------------------------------------------- /code/matlab/colors/qual_seq.m: -------------------------------------------------------------------------------- 1 | function colors = qual_seq(seq_variants, varargin) 2 | 3 | p = inputParser; 4 | p.KeepUnmatched = true; 5 | addParameter(p, 'flat', false, @islogical); 6 | addParameter(p, 'scheme', 'lines', @(a) ismember(a, {'cartocolor' 'colorbrewer2' 'macsspring' 'lines'})); 7 | parse(p, varargin{:}); 8 | 9 | scheme_cartocolor = { 10 | 'd1eeea' 'a8dbd9' '85c4c9' '68abb8' '4f90a6' '3b738f' '2a5674' 11 | 'ecda9a' 'efc47e' 'f3ad6a' 'f7945d' 'f97b57' 'f66356' 'ee4d5a' 12 | 'f3e0f7' 'e4c7f1' 'd1afe8' 'b998dd' '9f82ce' '826dba' '63589f' 13 | 'c4e6c3' '96d2a4' '6dbc90' '4da284' '36877a' '266b6e' '1d4f60' 14 | 'ffc6c4' 'f4a3a8' 'e38191' 'cc607d' 'ad466c' '8b3058' '672044' 15 | }; 16 | 17 | scheme_colorbrewer2 = { 18 | 'eff3ff' 'c6dbef' '9ecae1' '6baed6' '3182bd' '08519c' 19 | 'feedde' 'fdd0a2' 'fdae6b' 'fd8d3c' 'e6550d' 'a63603' 20 | 'edf8e9' 'c7e9c0' 'a1d99b' '74c476' '31a354' '006d2c' 21 | 'f2f0f7' 'dadaeb' 'bcbddc' '9e9ac8' '756bb1' '54278f' 22 | }; 23 | 24 | scheme_macsspring = { 25 | 'D4EFFB' 'A6DEF4' '79CDEE' '4ABBE7' '1CAAE0' '1C99CF' '1C86BD' '20739F' '265D81' 26 | 'FFEDBE' 'FAD79D' 'F4C07D' 'EEAA5C' 'E9923B' 'D68134' 'C46E2E' 'B25C27' '9F4920' 27 | 'F2E6F1' 'E1D2E5' 'D0BDDA' 'BFA9CD' 'AE94C2' '9A7CB4' '8966A8' '775699' '6B4A90' 28 | 'E8F1CD' 'D3E7AD' 'B9DB84' '9ECD5D' '8AC046' '79B041' '6D9D44' '608844' '547644' 29 | 'FFE5D7' 'FECFC0' 'F8B2A2' 'F49787' 'F17C6C' 'E16458' 'CF4A46' 'B8323B' 'A32034' 30 | 'FBF2BD' 'F8E399' 'F5D672' 'F2C951' 'EFBA38' 'D8AA45' 'C19A3F' 'A98A39' '927A36' 31 | 'D7EEED' 'B2E1E1' '8ED3D5' '69C6C8' '4CB7BB' '39A5AA' '33929A' '2E8189' '286E79' 32 | 'FBE5EF' 'F8CEE2' 'F7B2D0' 'F396BF' 'F073AC' 'E05F96' 'CD4D83' 'B53A6A' 'A12D58' 33 | }; 34 | scheme_lines = { 35 | '99E6FF' '85C7EC' '72A9D9' '608BC6' '506FB2' '42549F' '353C8C' '2B2979' '291F66' 36 | 'FFDD66' 'F9CA57' 'F2B649' 'ECA13B' 'E58C2E' 'DF7521' 'D95F16' 'D2480B' 'CC3100' 37 | 'ABE62E' '89D72B' '6AC928' '4EBA25' '36AC22' '209E20' '1D8F2C' '1A8135' '17733C' 38 | 'FFCCFA' 'EFAAEF' 'D78BDF' 'BD6FCF' 'A156BF' '8440AF' '672C9F' '4C1B8F' '310D80' 39 | 'FF4D00' 'EC2F03' 'D91505' 'C6070F' 'B20922' '9F0A31' '8C0B3B' '790B40' '660A41' 40 | 'B2FFE8' '8FE9D1' '6ED2BC' '52BCA8' '3AA696' '268F84' '157972' '09635F' '004D4D' 41 | 'FFE666' 'ECD053' 'D9BA41' 'C6A431' 'B28F24' '9F7A18' '8C670E' '795506' '664300' 42 | }; 43 | %{ 44 | scheme_bold = { 45 | '3969AC' '3969AC' 46 | 'E68310' 'E68310' 47 | '7F3C8D' '7F3C8D' 48 | '11A579' '11A579' 49 | 'F2B701' 'F2B701' 50 | 'E73F74' 'E73F74' 51 | '80BA5A' '80BA5A' 52 | '008695' '008695' 53 | 'CF1C90' 'CF1C90' 54 | 'F97B72' 'F97B72' 55 | '4B4B8F' '4B4B8F' 56 | 'A5AA99' 'A5AA99' 57 | }; 58 | %} 59 | 60 | switch p.Results.scheme 61 | case 'cartocolor' 62 | scheme_hex = scheme_cartocolor; 63 | case 'colorbrewer2' 64 | scheme_hex = scheme_colorbrewer2; 65 | case 'macsspring' 66 | scheme_hex = scheme_macsspring; 67 | case 'lines' 68 | scheme_hex = scheme_lines; 69 | %case 'bold' 70 | % scheme_hex = scheme_bold; 71 | end 72 | 73 | scheme = cellfun(@(a) hex2dec(reshape(a,2,[])')./255, scheme_hex, 'UniformOutput', false); 74 | 75 | [numColors, scheme_variants] = size(scheme_hex); 76 | numVariants = ones(1,numColors); 77 | if isscalar(seq_variants) 78 | numVariants = ones(1,numColors)*seq_variants; 79 | else 80 | numVariants(1:length(seq_variants)) = seq_variants; 81 | end 82 | 83 | polyfits = cell(numColors, 3); 84 | colors = cell(numColors,1); 85 | 86 | 87 | for color = 1:numColors 88 | rgb = [scheme{color,:}]; 89 | for primary = 1:3 90 | polyfits{color,primary} = polyfit(linspace(0, 1, scheme_variants), rgb(primary,:), 2); 91 | end 92 | 93 | %{ 94 | % plot polyfit match 95 | figure(color); clf; hold on; 96 | set(gca(), 'ColorOrder', eye(3)); 97 | plot(rgb'); 98 | plot(1:scheme_variants, cell2mat(arrayfun(@(primary) {polyval(polyfits{color, primary}, linspace(0,1,scheme_variants))'}, [1:3]))); 99 | ylim([0 1]); 100 | %} 101 | 102 | if numVariants(color) > 1 103 | colors{color} = arrayfun( ... 104 | @(variant) {arrayfun( ... 105 | @(primary) limit(polyval(polyfits{color, primary}, variant),[0,1]), ... 106 | 1:3)}, ... 107 | linspace(0, 1, numVariants(color)) ... 108 | )'; 109 | else 110 | colors{color} = {arrayfun(@(primary) limit(polyval(polyfits{color, primary}, 0.5), [0,1]), 1:3)}; 111 | end 112 | end 113 | 114 | %{ 115 | % plot output colors 116 | figure(22); clf; hold on; 117 | for c = 1:numColors 118 | for v = 1:numVariants(c) 119 | col = colors{c}{v}; 120 | plot(v, -c, 'o', 'markersize',50, 'markeredgecolor',col, 'markerfacecolor',col) 121 | end 122 | end 123 | %} 124 | 125 | if p.Results.flat 126 | colors = cell2mat(cellfun(@(a) cell2mat(a), colors, 'UniformOutput', false)); 127 | end 128 | 129 | end -------------------------------------------------------------------------------- /code/matlab/main_lag.m: -------------------------------------------------------------------------------- 1 | 2 | 3 | %% 4 | cd(fileparts(matlab.desktop.editor.getActive().Filename)); 5 | d = dir(pwd); 6 | paths = cellfun(@genpath, {d([d.isdir] & ~cellfun(@(s) startsWith(s, '.'), {d.name})).name}, 'un',0); 7 | addpath(paths{:}); 8 | 9 | clear variables; 10 | close all; 11 | font_mono = 'Space Mono'; 12 | set(0, 'defaultFigureWindowStyle', 'docked'); 13 | set(0, 'defaultAxesFontName', font_mono); 14 | set(0, 'defaultAxesFontSize', 12); 15 | set(0, 'defaultAxesTitleFontWeight', 'normal'); 16 | set(0, 'defaultAxesTitleFontSizeMultiplier', 1.6); 17 | set(0, 'defaultTextFontName', font_mono); 18 | %set(0, 'defaultLegendFontName', font_mono); 19 | 20 | 21 | 22 | 23 | 24 | %% DARK MODE? 25 | %{ 26 | f = gcf(); 27 | ax = gca(); 28 | set(ax, 'color','k') 29 | set(ax, 'xcolor','w') 30 | set(ax, 'ycolor','w') 31 | set(ax, 'gridcolor','w') 32 | set(f, 'color','k') 33 | set(ax.Legend, 'color','k') 34 | set(ax.Legend, 'textcolor','w') 35 | %} 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /code/matlab/main_lag_00.m: -------------------------------------------------------------------------------- 1 | main_lag_init; 2 | 3 | %% 4 | folder = '..\..\assets\00-cables-and-inputs\'; 5 | lagData = LagData([folder 'data.json'], [folder 'properties.json']); 6 | figureRes = [1280 720]; 7 | 8 | 9 | %% INPUT REMAPPING 10 | %% 11 | f = figure; clf; 12 | f.Name = 'Input: Keyboard click remapping'; 13 | lagData.plot({... 14 | 'Input device' 'Keyboard' 15 | 'Input from hardware' [] 16 | 'Input remapping' [] 17 | 'Input to game' {'Key click', 'Mouse click'} 18 | }, ... 19 | 'title',f.Name); 20 | 21 | %% 22 | f = figure; clf; 23 | f.Name = 'Input: Mouse click remapping'; 24 | lagData.plot({... 25 | 'Input device' 'Mouse' 26 | 'Input remapping' [] 27 | 'Input from hardware' {'Key click', 'Mouse click'} 28 | 'Input to game' {'Key click', 'Mouse click'} 29 | }, ... 30 | 'title',f.Name) 31 | 32 | %% 33 | f = figure; clf; 34 | f.Name = 'Input: Mouse move'; 35 | lagData.plot({... 36 | 'Input device' [] 37 | 'Input remapping' [] 38 | 'Input from hardware' [] 39 | 'Input to game' 'Mouse move' 40 | }, ... 41 | 'title',f.Name); 42 | 43 | %% 44 | f = figure; clf; 45 | f.Name = 'Input: Move vs. Click'; 46 | lagData.plot({... 47 | 'Input device' 'Mouse' 48 | 'Input to game' [] 49 | 'Input from hardware' @(a) ~strcmp(a, '(undefined)') 50 | 'Input remapping' {'None' 'Winuser' 'Interception'} 51 | }, ... 52 | 'title',f.Name); 53 | 54 | %% 55 | f = figure; clf; 56 | f.Name = 'All input types'; 57 | lagData.plot({... 58 | 'Input to game' [] 59 | 'Input device' [] 60 | 'Input from hardware' @(a) ~strcmp(a, '(undefined)') 61 | 'Input remapping' [] 62 | }, ... 63 | 'title',f.Name); 64 | %{ 65 | 10-15 : mouse -> remap -> move 66 | 15-20 : keyboard -> icue -> move 67 | 20-25 : mouse -> remap/none -> click 68 | 25-30 : keyboard -> remap/none -> click 69 | 30-40 : keyboard -> icue -> click 70 | %} 71 | 72 | %% EXTENDED CABLES 73 | f = figure; clf; 74 | f.Name = 'Cable extension'; 75 | lagData.plot({... 76 | '15m extended cables' @(a) ~strcmp(a, '(undefined)') 77 | }, ... 78 | 'title',f.Name, 'ymax',40, 'hist',true); 79 | 80 | %% NUM SAMPLES NEEDED 81 | name = 'Response time median vs. num samples'; 82 | item = lagData.search({'15m extended cables', 'None'}); % currently the largest sample count 83 | vals = cell2mat(item.values(:,2)'); 84 | [n, m] = size(vals); 85 | medians = zeros(n,m); 86 | for i = 1:n 87 | medians(i,:) = median(vals(1:i, :)); 88 | end 89 | f = figure; clf; hold on; 90 | plot(medians); 91 | ylabel('cumulative median'); 92 | xlabel('num samples'); 93 | title(name); 94 | saveFig(f, sprintf('%s%03d-%s', folder, f.Number, filenameify(name)), figureRes); 95 | 96 | %% 97 | saveOpenFigs(folder, figureRes); 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /code/matlab/main_lag_01.m: -------------------------------------------------------------------------------- 1 | main_lag_init; 2 | 3 | %% 4 | folder = '..\..\assets\01-nvidia-reflex\'; 5 | lagData = LagData([folder, 'data.json'], [folder, 'properties.json']); 6 | close all; 7 | xlim = [2 20]; 8 | figureRes = [1280 720]; 9 | 10 | 11 | 12 | 13 | %% 14 | f = figure; clf; 15 | f.Name = 'Baseline'; 16 | lagData.plot({}, ... 17 | 'title',f.Name, 'hist',true, 'ymax',45, 'xlim',xlim); 18 | 19 | 20 | %% 21 | f = figure; clf; 22 | f.Name = 'Different locations'; 23 | lagData.plot({... 24 | 'In-game location' @(a) ~isempty(a) 25 | }, ... 26 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 27 | 28 | 29 | %% 30 | f = figure; clf; 31 | f.Name = 'Different sessions'; 32 | lagData.plot({'misc', {'old 150 sample baseline', 'example mismatching baseline', ''}}, ... 33 | 'title',f.Name, 'hist',true, 'ymax',45, 'xlim',xlim); 34 | 35 | 36 | %% 37 | f = figure; clf; 38 | f.Name = 'GPU overclock'; 39 | lagData.plot({... 40 | 'GPU Core clock' [] 41 | 'GPU Memory clock' [] 42 | }, ... 43 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 44 | 45 | 46 | %% 47 | f = figure; clf; 48 | f.Name = 'GSync'; 49 | lagData.plot({... 50 | 'GSync' [] 51 | }, ... 52 | 'title',f.Name, 'hist',true, 'ymax',45, 'xlim',xlim); 53 | 54 | 55 | %% 56 | f = figure; clf; 57 | f.Name = 'GSync - Split FPS range'; 58 | items = lagData.search({}); 59 | itemsSub165 = lagData.selectFPS(items, @(fps)fps<165); 60 | itemsSup165 = lagData.selectFPS(items, @(fps)fps>165); 61 | items = lagData.addDefaultProperties([itemsSub165, itemsSup165, lagData.search({'GSync','Off'})]); 62 | items = lagData.sortItems(items, {'GSync',[];'FPS selection',[]}); 63 | lagData.plot(items, ... 64 | 'title',f.Name, 'hist',true, 'ymax',45, 'xlim',xlim); 65 | 66 | 67 | %% 68 | f = figure; clf; 69 | f.Name = 'Reduce Buffering'; 70 | lagData.plot({... 71 | 'Reduce buffering' [] 72 | }, ... 73 | 'title',f.Name, 'hist',true, 'ymax',45, 'xlim',xlim); 74 | 75 | 76 | 77 | 78 | %% 79 | f = figure; clf; 80 | f.Name = 'Nvidia Reflex - CPU limited'; 81 | lagData.plot({... 82 | 'Nvidia reflex' {'Enabled', 'Disabled'} 83 | 'Reduce buffering' {'Off', 'On'} 84 | }, ... 85 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 86 | 87 | 88 | %% 89 | f = figure; clf; 90 | f.Name = 'Nvidia Reflex - CPU limited - Boost?'; 91 | lagData.plot({... 92 | 'Nvidia reflex' [] 93 | }, ... 94 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 95 | 96 | 97 | 98 | %% 99 | f = figure; clf; 100 | f.Name = 'Nvidia Reflex - CPU limited - No GPU OC - Boost?'; 101 | lagData.plot({... 102 | 'Nvidia reflex' [] 103 | 'GPU Core clock' 'Auto' 104 | 'GPU Memory clock' '5000 MHz' 105 | }, ... 106 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 107 | 108 | 109 | %% 110 | f = figure; clf; 111 | f.Name = 'CPU limited - Boost vs OC'; 112 | items = [lagData.search({... 113 | 'Nvidia reflex' {'Enabled + Boost'} 114 | 'GPU Core clock' 'Auto' 115 | 'GPU Memory clock' '5000 MHz' 116 | }), lagData.search({ ... 117 | 'Nvidia reflex' {'Enabled'} 118 | })]; 119 | lagData.plot(items, ... 120 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 121 | 122 | 123 | 124 | %% 125 | f = figure; clf; 126 | f.Name = 'GPU limited'; 127 | lagData.plotMaxLimit({... 128 | 'Hardware FPS limit' 'GPU' 129 | 'Hardware max FPS' [] 130 | 'Render scale' '200%' 131 | }, ... 132 | 'title',f.Name, 'minmax',false, 'xlim',xlim); 133 | 134 | 135 | %% 136 | f = figure; clf; 137 | f.Name = 'GPU limited - Nvidia Reflex Enabled'; 138 | lagData.plotMaxLimit({... 139 | 'Nvidia reflex' 'Enabled' 140 | 'Hardware FPS limit' 'GPU' 141 | 'Hardware max FPS' [] 142 | 'Render scale' '200%' 143 | }, ... 144 | 'title',f.Name, 'minmax',false, 'xlim',xlim); 145 | 146 | 147 | %% 148 | f = figure; clf; 149 | f.Name = 'GPU limited - Nvidia Reflex'; 150 | lagData.plotMaxLimit({... 151 | 'Nvidia reflex' [] 152 | 'Hardware FPS limit' 'GPU' 153 | 'Hardware max FPS' [] 154 | 'Render scale' '200%' 155 | }, ... 156 | 'title',f.Name, 'minmax',false, 'xlim',xlim); 157 | 158 | 159 | %% 160 | f = figure; clf; 161 | f.Name = 'GPU limited - Nvidia Reflex - No OC'; 162 | lagData.plotMaxLimit({... 163 | 'Nvidia reflex' [] 164 | 'GPU Core clock' 'Auto' 165 | 'GPU Memory clock' '5000 MHz' 166 | 'Hardware FPS limit' 'GPU' 167 | 'Hardware max FPS' [] 168 | 'Render scale' '200%' 169 | }, ... 170 | 'title',f.Name, 'minmax',false, 'xlim',xlim); 171 | 172 | 173 | %% 174 | f = figure; clf; 175 | f.Name = 'GPU limited - Nvidia Reflex - Boost vs OC'; 176 | items = [lagData.search({... 177 | 'Nvidia reflex' {'Enabled + Boost'} 178 | 'GPU Core clock' 'Auto' 179 | 'GPU Memory clock' '5000 MHz' 180 | 'Hardware FPS limit' 'GPU' 181 | 'Hardware max FPS' [] 182 | 'Render scale' '200%' 183 | }), lagData.search({ ... 184 | 'Nvidia reflex' {'Enabled'} 185 | 'Hardware FPS limit' 'GPU' 186 | 'Hardware max FPS' [] 187 | 'Render scale' '200%' 188 | })]; 189 | lagData.plotMaxLimit(items, ... 190 | 'title',f.Name, 'minmax',false, 'xlim',xlim); 191 | 192 | 193 | %% 194 | f = figure; clf; 195 | f.Name = 'GPU limited - Reduce Buffering Off - Nvidia Reflex'; 196 | lagData.plotMaxLimit({... 197 | 'Nvidia reflex' [] 198 | 'Reduce buffering' 'Off' 199 | 'Hardware FPS limit' 'GPU' 200 | 'Hardware max FPS' [] 201 | 'Render scale' '200%' 202 | }, ... 203 | 'title',f.Name, 'minmax',false, 'xlim',xlim); 204 | 205 | 206 | %% 207 | f = figure; clf; 208 | f.Name = 'GPU limited - Nvidia Reflex Enabled - Reduce Buffering'; 209 | lagData.plotMaxLimit({... 210 | 'Nvidia reflex' 'Enabled' 211 | 'Reduce buffering' [] 212 | 'Hardware FPS limit' 'GPU' 213 | 'Hardware max FPS' [] 214 | 'Render scale' '200%' 215 | }, ... 216 | 'title',f.Name, 'minmax',false, 'xlim',xlim); 217 | 218 | 219 | 220 | %% 221 | f = figure; clf; 222 | f.Name = 'Low latency mode - Reflex enabled'; 223 | lagData.plot({... 224 | 'Nvidia reflex' [] 225 | 'Low latency mode' [] 226 | }, ... 227 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 228 | 229 | 230 | %% 231 | f = figure; clf; 232 | f.Name = 'Nvidia Reflex - CPU limited - Measurement 2'; 233 | lagData.plot({... 234 | 'misc', '1K re-sample' 235 | 'Nvidia reflex' [] 236 | 'Reduce buffering' [] 237 | }, ... 238 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 239 | 240 | %% 241 | f = figure; clf; 242 | f.Name = 'Nvidia Reflex - GPU limited - Measurement 2'; 243 | lagData.plot({... 244 | 'misc' '1K re-sample' 245 | 'Nvidia reflex' 'Enabled' 246 | 'Hardware FPS limit' 'GPU' 247 | 'Render scale' '200%' 248 | 'Reduce buffering' [] 249 | }, ... 250 | 'title',f.Name, 'ymax',45, 'xlim',xlim); 251 | 252 | %% 253 | f = figure; clf; 254 | f.Name = 'Reflex mis-prediction'; 255 | lagData.plot({... 256 | 'Nvidia reflex' 'Enabled' 257 | 'In-game location' @(a) ~isempty(a) 258 | }, ... 259 | 'title',f.Name, 'hist',true, 'minmax',false, 'ymax',45, 'xlim',xlim); 260 | 261 | 262 | 263 | 264 | %% 265 | 266 | saveOpenFigs(folder, figureRes); 267 | 268 | 269 | 270 | 271 | 272 | 273 | -------------------------------------------------------------------------------- /code/matlab/main_lag_init.m: -------------------------------------------------------------------------------- 1 | %% 2 | cd(fileparts(matlab.desktop.editor.getActive().Filename)); 3 | d = dir(pwd); 4 | paths = cellfun(@genpath, {d([d.isdir] & ~cellfun(@(s) startsWith(s, '.'), {d.name})).name}, 'un',0); 5 | addpath(paths{:}); 6 | 7 | clear variables; 8 | close all; 9 | font_mono = 'Space Mono'; 10 | set(0, 'defaultFigureWindowStyle', 'docked'); 11 | set(0, 'defaultAxesFontName', font_mono); 12 | set(0, 'defaultAxesFontSize', 12); 13 | set(0, 'defaultAxesTitleFontWeight', 'normal'); 14 | set(0, 'defaultAxesTitleFontSizeMultiplier', 1.6); 15 | set(0, 'defaultTextFontName', font_mono); 16 | %set(0, 'defaultLegendFontName', font_mono); 17 | 18 | 19 | -------------------------------------------------------------------------------- /code/matlab/util/addLabel.m: -------------------------------------------------------------------------------- 1 | function addLabel(ax, color, name) 2 | 3 | p = plot(NaN,NaN,'s', 'markersize',10, 'markerfacecolor',color, 'color',color, ... 4 | 'displayname',name); 5 | 6 | if isempty(ax.Legend) 7 | legend(p, 'location','northeast','autoupdate','off'); 8 | else 9 | lgd = ax.Legend; 10 | if strcmp(lgd.String{end}, name) == 0 11 | lgd.PlotChildren(end+1) = p; 12 | end 13 | end 14 | end -------------------------------------------------------------------------------- /code/matlab/util/consecutive.m: -------------------------------------------------------------------------------- 1 | function out = consecutive(array, fn, n) 2 | 3 | out = all(cell2mat(arrayfun(@(nn) fn(circshift(array,nn)), -1*(0:n), 'un',0)), 2); 4 | 5 | end 6 | -------------------------------------------------------------------------------- /code/matlab/util/filenameify.m: -------------------------------------------------------------------------------- 1 | function filename = filenameify(string) 2 | 3 | src = {'<' '>' ':' '"' '/' '\' '|' '?' '*' ' '}; 4 | dst = {'(' ')' '-' '' '-' '-' '-' '' '-' '-'}; 5 | 6 | filename = ''; 7 | for i = 1:length(string) 8 | [ismem, idx] = ismember(string(i), src); 9 | if ismem 10 | filename = [filename, dst{idx}]; 11 | else 12 | filename = [filename, lower(string(i))]; 13 | end 14 | end 15 | 16 | filename = regexprep(filename, '-+', '-'); 17 | 18 | end -------------------------------------------------------------------------------- /code/matlab/util/geometricBracket.m: -------------------------------------------------------------------------------- 1 | function bkts = geometricBracket(base, ratio, spread, rounding) 2 | % base: Base value from which resultant values are bracketed 3 | % ratio: [divisions, x-ade], the ratio of a higher value ofer a lower one 4 | % eg: [5, 2] - 5 increments to double the value (5 per octave) 5 | % (going up 'divisions' increments will 'x-ade' the value) 6 | % spread: an integer-vector of bracketing around the base value 7 | % eg [-2 -1 0 1 2] for a 5-bkt around the base valuemouse 8 | 9 | bkts = base * ratio(2).^(spread/ratio(1)); 10 | if nargin < 4 || rounding 11 | bkts = round(bkts, 0); 12 | end 13 | 14 | end -------------------------------------------------------------------------------- /code/matlab/util/legendColorItem.m: -------------------------------------------------------------------------------- 1 | function legendColorItem(axes, color, text, varargin) 2 | 3 | 4 | p = inputParser; 5 | p.KeepUnmatched = true; 6 | addParameter(p, 'Marker', 's', @ischar); 7 | addParameter(p, 'MarkerSize', 20, @(a) isscalar(a) & isreal(a) & a>0); 8 | addParameter(p, 'MarkerFaceColor', []); 9 | addParameter(p, 'Location', 'northwest', @ischar); 10 | parse(p, varargin{:}); 11 | 12 | markerFaceColor = p.Results.MarkerFaceColor; 13 | if isempty(markerFaceColor) 14 | markerFaceColor = color; 15 | end 16 | 17 | p_name = plot(axes, NaN, NaN, p.Results.Marker, ... 18 | 'MarkerFaceColor', markerFaceColor, 'Color', color, ... 19 | 'MarkerSize',p.Results.MarkerSize, ... 20 | 'DisplayName',text); 21 | 22 | if isempty(axes.Legend) 23 | legend(axes, p_name, 'Location',p.Results.Location, 'AutoUpdate','off'); 24 | else 25 | axes.Legend.PlotChildren(end+1) = p_name; 26 | end 27 | end -------------------------------------------------------------------------------- /code/matlab/util/limit.m: -------------------------------------------------------------------------------- 1 | function [ v ] = limit( range, limits ) 2 | v = min(max(range, limits(1)), limits(2)); 3 | end -------------------------------------------------------------------------------- /code/matlab/util/map.m: -------------------------------------------------------------------------------- 1 | function m = map(initializer, isUniform) 2 | 3 | if nargin < 2 4 | isUniform = true; 5 | end 6 | 7 | if isa(initializer, 'cell') 8 | if isempty(initializer) 9 | m = containers.Map('UniformValues',isUniform); 10 | else 11 | if size(initializer,1) == 1 && mod(size(initializer,2), 2) == 0 && size(initializer,2) > 2 12 | initializer = reshape(initializer, 2, [])'; 13 | end 14 | m = containers.Map(initializer(:,1), initializer(:,2), 'UniformValues',isUniform); 15 | end 16 | elseif isa(initializer, 'containers.Map') 17 | if initializer.Count == 0 18 | m = containers.Map(); 19 | else 20 | m = containers.Map(keys(initializer), values(initializer), 'UniformValues',isUniform); 21 | end 22 | end 23 | end -------------------------------------------------------------------------------- /code/matlab/util/rescale.m: -------------------------------------------------------------------------------- 1 | function [ v, p ] = rescale( range, limits, inputRange ) 2 | % Linearly transform a range of numbers to fit a new range 3 | % 4 | % range: 5 | % Row vector of numbers, or matrix where each row will be individually rescaled 6 | % limits: 7 | % Vector of [lower, upper] limits for the output 8 | % inputRange (optinal, default=minmax(vec)): 9 | % Custom vector of [lower, upper] bounds for the input 10 | % 11 | % v: 12 | % The transformed vector 13 | % p: 14 | % The [scaling, translation] coefficients used 15 | % 16 | % Examples: 17 | % rescale([1, 2, 3], [4,7]) 18 | % >> 4.0 5.5 7.0 19 | % rescale([1, 2, 4], [4,1]) 20 | % >> 4 3 1 21 | % rescale([1, 2, 3], [0,1], [1,5]) 22 | % >> 0 0.25 0.5 23 | 24 | if nargin < 3 || isempty(inputRange) 25 | inputRange = minmax(range); 26 | end 27 | 28 | a = (limits(2)-limits(1))./(inputRange(:,2)-inputRange(:,1)); 29 | b = inputRange(:,1).*a - limits(1); 30 | 31 | v = a.*range - b; 32 | p = [a, b]; 33 | 34 | end 35 | 36 | -------------------------------------------------------------------------------- /code/matlab/util/saveFig.m: -------------------------------------------------------------------------------- 1 | function saveFig(fig, name, resolution) 2 | assert(isa(fig, 'matlab.ui.Figure')); 3 | assert(ischar(name)); 4 | assert(isvector(resolution) & length(resolution)==2); 5 | 6 | style = fig.WindowStyle; 7 | resize = fig.Resize; 8 | innerPos = fig.InnerPosition; 9 | 10 | res = [15 70 resolution(1) resolution(2)]; 11 | fig.WindowStyle = 'normal'; 12 | pause(0.15); % wait for the figure to properly undock 13 | fig.InnerPosition = res; 14 | 15 | hgexport(fig, [name '.png'], hgexport('factorystyle'), 'Format','png'); 16 | 17 | fig.InnerPosition = innerPos; 18 | fig.Resize = resize; 19 | fig.WindowStyle = style; 20 | end -------------------------------------------------------------------------------- /code/matlab/util/saveOpenFigs.m: -------------------------------------------------------------------------------- 1 | function saveOpenFigs(folder, resolution) 2 | figures = findall(groot, 'type','figure'); 3 | for fig_idx = 1:length(figures) 4 | f = figures(fig_idx); 5 | saveFig(f, sprintf('%s%03d-%s', folder, f.Number, filenameify(f.Name)), resolution); 6 | end 7 | end -------------------------------------------------------------------------------- /code/matlab/util/withinPrctiles.m: -------------------------------------------------------------------------------- 1 | function out = withinPrctiles(range, prctiles) 2 | out = range(ceil(prctiles(1)*length(range)/100):floor(prctiles(2)*length(range)/100), :); 3 | end -------------------------------------------------------------------------------- /inputUtils/OWFPSChanger.d: -------------------------------------------------------------------------------- 1 | import core.sys.windows.winbase; 2 | import core.sys.windows.windef; 3 | import core.sys.windows.winuser; 4 | import std; 5 | import core.thread; 6 | 7 | enum Hotkey : ushort { 8 | frameRateUp, 9 | frameRateUpNoInput, 10 | frameRateReset, 11 | frameRateDefault, 12 | } 13 | 14 | __gshared Duration menuLoadTime = 800.msecs; 15 | __gshared Duration escMenuOpenTime = 500.msecs; 16 | __gshared Duration tick = 17.msecs; 17 | 18 | enum Coordinates { 19 | videoMenu = POINT(3330, 3640), 20 | } 21 | 22 | POINT cursorPos(){ 23 | POINT p; 24 | GetCursorPos(&p); 25 | p.x = p.x*ushort.max/2560; 26 | p.y = p.y*ushort.max/1440; 27 | return p; 28 | } 29 | 30 | void main(string[] args){ 31 | ushort key = VK_F8; 32 | int defaultFramerate = 144; 33 | int tick_ms = 17; 34 | 35 | getopt(args, 36 | "k|key", &key, 37 | "f|defaultframerate", &defaultFramerate, 38 | "t|tick", &tick_ms, 39 | ); 40 | tick = tick_ms.msecs; 41 | 42 | RegisterHotKey(null, Hotkey.frameRateUp, 0x4000, key); 43 | RegisterHotKey(null, Hotkey.frameRateUpNoInput, 0x4002, key); // Ctrl + 44 | RegisterHotKey(null, Hotkey.frameRateReset, 0x4003, key); // Ctrl + Alt + 45 | RegisterHotKey(null, Hotkey.frameRateDefault, 0x4007, key); // Ctrl + Alt + Shift + 46 | 47 | auto frameRates = [400, 346, 300, 260, 225, 195, 169, 146, 128, 110, 95, 82, 71, 62, 53, 46, 40, 35, 30]; 48 | size_t frameRateIdx = 0; 49 | 50 | void frameRateCycleUp(){ 51 | frameRateIdx++; 52 | if(frameRateIdx >= frameRates.length){ 53 | frameRateIdx = 0; 54 | } 55 | writefln("%3d fps loaded", frameRates[frameRateIdx]); 56 | } 57 | 58 | INPUT[] inputs; 59 | 60 | auto msg = MSG(); 61 | while(GetMessage(&msg, null, 0, 0) != 0){ 62 | if(msg.message == WM_HOTKEY){ 63 | final switch(msg.wParam) with(Hotkey){ 64 | case frameRateUp: 65 | inputs.inputFrameRateCap(frameRates[frameRateIdx]); 66 | inputs.doInputSequence(); 67 | frameRateCycleUp(); 68 | break; 69 | case frameRateUpNoInput: 70 | frameRateCycleUp(); 71 | break; 72 | case frameRateReset: 73 | Thread.sleep(800.msecs); 74 | inputs.inputFrameRateCap(frameRates[0]); 75 | inputs.doInputSequence(); 76 | frameRateIdx = 1; 77 | break; 78 | case frameRateDefault: 79 | Thread.sleep(800.msecs); 80 | inputs.inputFrameRateCap(defaultFramerate); 81 | inputs.doInputSequence(); 82 | import core.stdc.stdlib; 83 | exit(0); 84 | return; 85 | } 86 | } 87 | } 88 | } 89 | 90 | 91 | void doInputSequence(ref INPUT[] inputs){ 92 | for(size_t idx; idx < inputs.length; idx++){ 93 | SendInput(1, &inputs[idx], INPUT.sizeof); 94 | Thread.sleep(tick); 95 | } 96 | inputs = null; 97 | } 98 | 99 | void inputOpenVideoMenu(ref INPUT[] inputs){ 100 | inputs.inputVKey(VK_ESCAPE); 101 | inputs.inputNop((escMenuOpenTime/tick + 1).to!uint); 102 | inputs.inputVKey(VK_DOWN, 2); 103 | inputs.inputVKey(VK_SPACE); 104 | inputs.inputNop((menuLoadTime/tick + 1).to!uint); 105 | inputs.inputClickOn(Coordinates.videoMenu); 106 | inputs.inputNop((menuLoadTime/tick + 1).to!uint); 107 | inputs.inputVKey(VK_TAB); 108 | } 109 | 110 | void inputFrameRateCap(ref INPUT[] inputs, int fps){ 111 | inputs.inputOpenVideoMenu(); 112 | 113 | // toggle-reset reduce buffering 114 | inputs.inputVKey(VK_DOWN, 7); 115 | inputs.inputVKey(VK_RIGHT, 1); 116 | inputs.inputVKey(VK_RETURN); 117 | inputs.inputVKey(VK_RIGHT, 1); 118 | inputs.inputVKey(VK_RETURN); 119 | 120 | // set new fps cap 121 | inputs.inputVKey(VK_DOWN, 7); 122 | foreach(ch; fps.to!string){ 123 | inputs.inputVKey(cast(ushort)ch); 124 | } 125 | inputs.inputVKey(VK_RETURN); 126 | 127 | // close menu 128 | inputs.inputNop(1); 129 | inputs.inputVKey(VK_ESCAPE); 130 | inputs.inputNop(1); 131 | inputs.inputVKey(VK_ESCAPE); 132 | } 133 | 134 | 135 | void inputNop(ref INPUT[] inputs, uint count){ 136 | foreach(i; 0 .. count){ 137 | inputs ~= INPUT(INPUT_MOUSE, MOUSEINPUT(0, 0, 0, 0, 0, 0)); 138 | } 139 | } 140 | 141 | void inputMove(ref INPUT[] inputs, POINT p){ 142 | inputs ~= INPUT(INPUT_MOUSE, MOUSEINPUT(p.x, p.y, 0, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, 0, 0)); 143 | } 144 | 145 | void inputClickOn(ref INPUT[] inputs, POINT p){ 146 | inputs.inputMove(p); 147 | inputs ~= INPUT(INPUT_MOUSE, MOUSEINPUT(0, 0, 0, MOUSEEVENTF_LEFTDOWN, 0, 0)); 148 | inputs ~= INPUT(INPUT_MOUSE, MOUSEINPUT(0, 0, 0, MOUSEEVENTF_LEFTUP, 0, 0)); 149 | } 150 | 151 | void inputScroll(ref INPUT[] inputs, int n){ 152 | // n>0 : up | n<0 : down 153 | INPUT input; 154 | int dir = (n>0) ? 1 : -1; 155 | int count = abs(n); 156 | foreach(i; 0 .. count){ 157 | inputs ~= INPUT(INPUT_MOUSE, MOUSEINPUT(0, 0, dir, MOUSEEVENTF_WHEEL, 0, 0)); 158 | } 159 | } 160 | 161 | void inputVKey(ref INPUT[] inputs, ushort vk, uint repeat = 1){ 162 | foreach(i; 0 .. repeat){ 163 | inputs ~= INPUTk(KEYBDINPUT(vk, 0, 0, 0, 0)); 164 | inputs ~= INPUTk(KEYBDINPUT(vk, 0, KEYEVENTF_KEYUP, 0, 0)); 165 | } 166 | } 167 | 168 | INPUT INPUTk(KEYBDINPUT ki){ 169 | INPUT input; 170 | input.type = INPUT_KEYBOARD; 171 | input.ki = ki; 172 | return input; 173 | } -------------------------------------------------------------------------------- /inputUtils/f7remap.d: -------------------------------------------------------------------------------- 1 | 2 | 3 | import std.stdio : writeln, writefln; 4 | import std.getopt; 5 | import interception.interceptiond; 6 | 7 | enum Scancode : ushort { 8 | E = 18, 9 | F7 = 65, 10 | F9 = 67, 11 | } 12 | 13 | enum Action { 14 | move, 15 | click, 16 | } 17 | 18 | void main(string[] args){ 19 | Action action; 20 | int x = 200; 21 | int y = 0; 22 | ushort remapSourceScancode = Scancode.F7; 23 | getopt(args, 24 | "a|action", &action, 25 | "x", &x, 26 | "y", &y, 27 | "s|source", &remapSourceScancode, 28 | ); 29 | 30 | Devices devices = createDevices(); 31 | scope(exit) destroyDevices(devices); 32 | 33 | setFilter(devices, KeyboardStateFilter(KSF.up, KSF.down)); 34 | scope(exit) setFilter(devices, KeyboardStateFilter(KSF.none)); 35 | setFilter(devices, MouseStateFilter(MSF.move)); 36 | scope(exit) setFilter(devices, MouseStateFilter(MSF.none)); 37 | 38 | MouseDevice mouse; 39 | 40 | writefln("Move the mouse that should send the remapped action (%s)...", action); 41 | 42 | auto loop = true; 43 | while(loop){ 44 | devices.receive.visit!( 45 | (MouseEvent e){ 46 | e.device.write(e.stroke); 47 | mouse = e.device; 48 | setFilter(devices, MouseStateFilter(MSF.none)); 49 | writefln("Mouse set to device %s", e.stroke.id); 50 | }, 51 | (KeyboardEvent e){ 52 | //writeln(e); 53 | e.device.write(e.stroke); 54 | if(e.stroke.code == remapSourceScancode){ 55 | final switch(action) with(Action){ 56 | case click: 57 | MouseStroke click = { 58 | state: (e.stroke.state == KeyboardState(KS.down)) 59 | ? MouseState(MS.leftButtonDown) 60 | : MouseState(MS.leftButtonUp), 61 | }; 62 | mouse.write(click); 63 | break; 64 | case move: 65 | MouseStroke move = { 66 | settings: MouseSettings(MSt.moveRelative), 67 | x: (e.stroke.state == KeyboardState(KS.down)) ? -x : x, 68 | y: (e.stroke.state == KeyboardState(KS.down)) ? -y : y, 69 | }; 70 | mouse.write(move); 71 | break; 72 | } 73 | } 74 | //if(e.stroke.code == Scancode.F9){ 75 | // writeln("quit"); 76 | // loop = false; 77 | //} 78 | } 79 | ); 80 | } 81 | } 82 | 83 | -------------------------------------------------------------------------------- /inputUtils/interception/cport/interception.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/inputUtils/interception/cport/interception.dll -------------------------------------------------------------------------------- /inputUtils/interception/cport/interception.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klasbo/GamePerfTesting/777ea38c222865829057b8c7d09902439b428ebc/inputUtils/interception/cport/interception.lib -------------------------------------------------------------------------------- /inputUtils/interception/cport/interceptiond.d: -------------------------------------------------------------------------------- 1 | 2 | 3 | enum interceptionMaxKeyboard = 10; 4 | enum interceptionMaxMouse = 10; 5 | enum interceptionMaxDevice = interceptionMaxKeyboard + interceptionMaxMouse; 6 | 7 | int interceptionKeyboard(int index){ 8 | return index + 1; 9 | } 10 | 11 | int interceptionMouse(int index){ 12 | return interceptionMaxKeyboard + index + 1; 13 | } 14 | 15 | alias InterceptionContext = void*; 16 | alias InterceptionDevice = int; 17 | alias InterceptionPrecedence = int; 18 | alias InterceptionFilter = ushort; 19 | 20 | alias InterceptionPredicate = extern(C) int function(InterceptionDevice); 21 | 22 | enum InterceptionKeyState : ushort { 23 | down = 0x00, 24 | up = 0x01, 25 | e0 = 0x02, 26 | e1 = 0x04, 27 | termsrvSetLed = 0x08, 28 | termsrvShadow = 0x10, 29 | termsrvVKPacket = 0x20, 30 | } 31 | 32 | enum InterceptionFilterKeyState : ushort { 33 | none = 0x0000, 34 | all = 0xffff, 35 | down = InterceptionKeyState.up, 36 | up = InterceptionKeyState.up << 1, 37 | e0 = InterceptionKeyState.e0 << 1, 38 | e1 = InterceptionKeyState.e1 << 1, 39 | termsrvSetLed = InterceptionKeyState.termsrvSetLed << 1, 40 | termsrvShadow = InterceptionKeyState.termsrvShadow << 1, 41 | termsrvVKPacket = InterceptionKeyState.termsrvVKPacket << 1, 42 | } 43 | 44 | enum InterceptionMouseState : ushort { 45 | none = 0, 46 | leftButtonDown = 0x001, 47 | leftButtonUp = 0x002, 48 | rightButtonDown = 0x004, 49 | rightButtonUp = 0x008, 50 | middleButtonDown = 0x010, 51 | middleButtonUp = 0x020, 52 | button1Down = InterceptionMouseState.leftButtonDown, 53 | button1Up = InterceptionMouseState.leftButtonUp, 54 | button2Down = InterceptionMouseState.rightButtonDown, 55 | button2Up = InterceptionMouseState.rightButtonUp, 56 | button3Down = InterceptionMouseState.middleButtonDown, 57 | button3Up = InterceptionMouseState.middleButtonUp, 58 | button4Down = 0x040, 59 | button4Up = 0x080, 60 | button5Down = 0x100, 61 | button5Up = 0x200, 62 | wheel = 0x400, 63 | hwheel = 0x800, 64 | } 65 | 66 | enum InterceptionFilterMouseState : ushort { 67 | none = 0x0000, 68 | all = 0xffff, 69 | leftButtonDown = InterceptionMouseState.leftButtonDown, 70 | leftButtonUp = InterceptionMouseState.leftButtonUp, 71 | rightButtonDown = InterceptionMouseState.rightButtonDown, 72 | rightButtonUp = InterceptionMouseState.rightButtonUp, 73 | middleButtonDown = InterceptionMouseState.middleButtonDown, 74 | middleButtonUp = InterceptionMouseState.middleButtonUp, 75 | button1Down = InterceptionMouseState.button1Down, 76 | button1Up = InterceptionMouseState.button1Up, 77 | button2Down = InterceptionMouseState.button2Down, 78 | button2Up = InterceptionMouseState.button2Up, 79 | button3Down = InterceptionMouseState.button3Down, 80 | button3Up = InterceptionMouseState.button3Up, 81 | button4Down = InterceptionMouseState.button4Down, 82 | button4Up = InterceptionMouseState.button4Up, 83 | button5Down = InterceptionMouseState.button5Down, 84 | button5Up = InterceptionMouseState.button5Up, 85 | wheel = InterceptionMouseState.wheel, 86 | hwheel = InterceptionMouseState.hwheel, 87 | move = 0x1000, 88 | } 89 | 90 | enum InterceptionMouseFlag : ushort { 91 | moveRelative = 0x000, 92 | moveAbsolute = 0x001, 93 | virtualDesktop = 0x002, 94 | attributesChanged = 0x004, 95 | moveNocoalesce = 0x008, 96 | termsrvSrcShadow = 0x100, 97 | } 98 | 99 | struct InterceptionMouseStroke { 100 | InterceptionMouseState state; 101 | InterceptionMouseFlag flags; 102 | short rolling; 103 | int x; 104 | int y; 105 | uint information; 106 | } 107 | 108 | struct InterceptionKeyStroke { 109 | ushort code; 110 | InterceptionKeyState state; 111 | uint information; 112 | } 113 | 114 | 115 | alias InterceptionStroke = char[InterceptionMouseStroke.sizeof]; 116 | 117 | 118 | extern(C){ 119 | InterceptionContext interception_create_context(); 120 | void interception_destroy_context(InterceptionContext context); 121 | 122 | InterceptionPrecedence interception_get_precedence(InterceptionContext context, InterceptionDevice device); 123 | void interception_set_precedence(InterceptionContext context, InterceptionDevice device, InterceptionPrecedence precedence); 124 | 125 | InterceptionFilter interception_get_filter(InterceptionContext context, InterceptionDevice device); 126 | void interception_set_filter(InterceptionContext context, InterceptionPredicate predicate, InterceptionFilter filter); 127 | 128 | InterceptionDevice interception_wait(InterceptionContext context); 129 | InterceptionDevice interception_wait_with_timeout(InterceptionContext context, ulong milliseconds); 130 | 131 | int interception_send(InterceptionContext context, InterceptionDevice device, const InterceptionStroke* stroke, uint nstroke); 132 | int interception_receive(InterceptionContext context, InterceptionDevice device, InterceptionStroke* stroke, uint nstroke); 133 | 134 | uint interception_get_hardware_id(InterceptionContext context, InterceptionDevice device, void* hardware_id_buffer, uint buffer_size); 135 | 136 | int interception_is_invalid(InterceptionDevice device); 137 | int interception_is_keyboard(InterceptionDevice device); 138 | int interception_is_mouse(InterceptionDevice device); 139 | 140 | } 141 | 142 | 143 | -------------------------------------------------------------------------------- /inputUtils/interception/cport/remap_interception.d: -------------------------------------------------------------------------------- 1 | // rdmd -m64 .\remap_interception.d 2 | 3 | pragma(lib, "interception.lib"); 4 | import interceptiond; 5 | import std; 6 | import core.memory; 7 | 8 | 9 | enum Scancode { 10 | F7 = 65, 11 | } 12 | 13 | enum RemapAction {xMove, 14 | leftClick, 15 | } 16 | 17 | enum action = RemapAction.leftClick; 18 | 19 | void main(){ 20 | writeln("started"); 21 | GC.disable; 22 | InterceptionContext context = interception_create_context(); 23 | scope(exit) interception_destroy_context(context); 24 | 25 | interception_set_filter(context, &interception_is_keyboard, InterceptionFilterKeyState.up | InterceptionFilterKeyState.down); 26 | interception_set_filter(context, &interception_is_mouse, InterceptionFilterMouseState.move); 27 | 28 | 29 | InterceptionDevice unknownDevice; 30 | InterceptionStroke stroke; 31 | InterceptionDevice mouse; 32 | while(interception_receive(context, unknownDevice = interception_wait(context), &stroke, 1) > 0){ 33 | interception_send(context, unknownDevice, &stroke, 1); 34 | if(interception_is_mouse(unknownDevice)){writefln("Mouse set to device %s", unknownDevice); 35 | mouse = unknownDevice; 36 | interception_set_filter(context, &interception_is_mouse, InterceptionFilterMouseState.none); 37 | } 38 | 39 | if(interception_is_keyboard(unknownDevice)){ 40 | auto keyStroke = *cast(InterceptionKeyStroke*)&stroke; 41 | 42 | static if(action == RemapAction.xMove){ 43 | if(keyStroke.code == Scancode.F7){ 44 | InterceptionMouseStroke mouseStroke = { 45 | flags: InterceptionMouseFlag.moveRelative, 46 | x: (keyStroke.state == InterceptionKeyState.down) ? -200 : 200, 47 | }; 48 | interception_send(context, mouse, cast(InterceptionStroke*)&mouseStroke, 1); 49 | } 50 | } else static if(action == RemapAction.leftClick){ 51 | if(keyStroke.code == Scancode.F7 && keyStroke.state == InterceptionKeyState.down){ 52 | InterceptionMouseStroke[2] mouseStroke = [ 53 | {state: InterceptionMouseState.leftButtonDown, }, 54 | {state: InterceptionMouseState.leftButtonUp, }, 55 | ]; 56 | interception_send(context, mouse, cast(InterceptionStroke*)mouseStroke.ptr, 2); 57 | } 58 | } 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /inputUtils/mousemeasure.d: -------------------------------------------------------------------------------- 1 | 2 | 3 | import std.stdio : writeln, writefln; 4 | import std.getopt; 5 | import interception.interceptiond; 6 | import std.concurrency : spawn; 7 | import core.thread; 8 | 9 | 10 | 11 | void main(string[] args){ 12 | 13 | Devices devices = createDevices(); 14 | scope(exit) destroyDevices(devices); 15 | 16 | setFilter(devices, KeyboardStateFilter(KSF.down)); 17 | scope(exit) setFilter(devices, KeyboardStateFilter(KSF.none)); 18 | setFilter(devices, MouseStateFilter(MSF.move)); 19 | scope(exit) setFilter(devices, MouseStateFilter(MSF.none)); 20 | 21 | 22 | int x; 23 | int y; 24 | 25 | while(true){ 26 | devices.receive.visit!( 27 | (MouseEvent e){ 28 | e.device.write(e.stroke); 29 | x += e.stroke.x; 30 | y += e.stroke.y; 31 | }, 32 | (KeyboardEvent e){ 33 | e.device.write(e.stroke); 34 | if(e.stroke.code == 65){ 35 | writefln!("%+6d %+6d")(x, y); 36 | x = 0; 37 | y = 0; 38 | } 39 | } 40 | ); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /text/01-variation.md: -------------------------------------------------------------------------------- 1 | 2 | Response time has variation 3 | =========================== 4 | 5 | The basic plot 6 | -------------- 7 | 8 | This figure shows the response time ("input lag") in Overwatch. 9 | 10 | 11 | 12 | - The sideways histograms: The distribution of the samples at each framerate 13 | - **`x`** markers: The median for the distributions at each framerate 14 | - `+` markers: The minimum and maximums 15 | - `--` dashed line: The best fit line for the medians 16 | 17 | Note that the plot is logarithmic on the x-axis. Each larger framerate is 13.5% higher than its neighbor. This representation more clearly shows the diminishing returns from going higher in framerate than a linear one would. Just note that the dashed line is in fact straight, it's just the "paper" that is curved. 18 | 19 | - `objs`: The number of samples for each framerate tested. 20 | *In this case 1000, for a total of 12000 samples in this image.* 21 | - `slope`: The gradient of the best fit line. 22 | *In this case 0.66, which means a 0.66 ms improvement (reduction) in response time for 1 ms decrease in frame interval.* 23 | - `base`: The theoretical median response time at infinite frames per second. 24 | *This is mostly included for completeness, though it is sometimes useful when comparing different scenarios.* 25 | 26 | FPS examples of 1 ms reduction in frame interval: `60->63.8`, `144->168`, `240->316`, `360->563`. This is another example of diminishing returns, though less intuitive than seeing it graphically. 27 | 28 | ### Observations 29 | 30 | **Distribution**: The response time varies *a lot*. Even at high framerates, response time varies from 10 to 20 ms. **There is no such thing as "constant input lag".** 31 | 32 | **Lag spike**: There is a spike in the maximums at 82 fps. This is the classic "lag spike", where Windows decides that other things than the game are more important, and delays execution of *something* related to the game. 33 | 34 | **Discontinuity**: There is a break from 169 to 146. This is because GSync is enabled with a 165 Hz monitor. 35 | 36 | **Symmetry**: The response time distribution is not symmetric, but it is close. And there is also a possibility of unbounded maximums (and the impossibility of unbounded minimums - you can never go faster than 0 ms). Because of this, the right thing to do is to use the *median*, and not the mean (though they are frequently very close). 37 | 38 | ### A comparison plot with GSync 39 | 40 | Here is a comparison plot for GSync: 41 | 42 | 43 | 44 | Because of the discontinuity around 165 fps, the blue trend line should really be split in two segments. 45 | 46 | 47 | 48 | From this we can conclude: 49 | 50 | - GSync has a small impact on response time. 51 | - The impact is not correlated with framerate (they share the same slope), so statements like "adds one frame of input lag" are wrong. 52 | - The impact on the median is more or less constant. 53 | - The impact on the minimums is about 2 ms when below refresh rate. 54 | - The distribution of response time "flattens" (less "normal" and more "uniform") when below refresh rate. 55 | 56 | Settings matter 57 | --------------- 58 | 59 | Not only is there a lot of variation in response time *in general*, there are also constant-offset effects, which are not-so-constant when in normal gameplay situations. 60 | 61 | The first is the impact of the testing location: 62 | 63 | 64 | 65 | The number refers to the maximum (uncapped) framerate obtained at that location when using 200% render scale. Lower max framerate means that there is more work to do to render that frame. More work means that it takes longer to do the work, and therefore the work will be completed later, and so response time drops. This is the case regardless of how long the breaks are between frames. 66 | 67 | At 260 fps, we see that response time can vary from 8 to 27 ms, a ~3.3x factor. Again, **there is no such thing as "constant input lag".** 68 | 69 | The second is the impact of random unknowns: 70 | 71 | 72 | 73 | These three runs were taken in different sessions. The goal was to increase the sample count from 150 to 1000 for a more accurate baseline, but for whatever reason a 50-sample test run gave results that were 2-3 ms higher than expected. Rebooting fixed the issue - we'll never know what happened... 74 | 75 | The third is hardware settings, with this example being a GPU overclock: 76 | 77 | 78 | 79 | Thermal throttling or other automatic frequency changes will have an impact on response time. Though the size of the effect might not be large, it is large enough to show up in measurements, and therefore large enough to invalidate results. 80 | 81 | Sample count matters 82 | -------------------- 83 | 84 | This figure shows the median of `[0..n]` samples, where each line is for a different framerate. 85 | 86 | 87 | 88 | The question is "how many samples do we need for an accurate result"? Things start to "clean up" around 150 samples, though only get really good around 500. But the answer is definitely not anything below 100. 89 | 90 | 91 | Tips for people doing response time measurements 92 | ------------------------------------------------ 93 | 94 | - You need large sample counts, 150 is a good compromise between accuracy and time taken. 95 | - You need to test multiple frame rates. 96 | - You should use the median, and not the mean. 97 | - You need to test at the same in-game location every time. 98 | - You must take a new baseline measurement for each testing session. 99 | - You must be wary of your game and system settings. 100 | (And re-measuring the baseline at the start and end of a session is a good way to be sure) 101 | - You need to make sure your system is properly configured and optimized. 102 | - You should not report single numbers, or numbers with higher precision than than your equipment can measure. 103 | 104 | If you are using a high-speed camera and counting frames, get with the programme and buy a microcontroller and a photodiode. --------------------------------------------------------------------------------