Cortical activity at different time scales: high ‐ pass �ltering separates motor planning and execution

The smooth conduction of movements requires simultaneous motor planning and execution according to internal goals. So far it is not known how such movement plans can be modi�ed without being distorted by ongoing movements. Previous studies have isolated planning and execution related neuronal activity by separating behavioral planning and movement periods in time by sensory cues1–7. Here, we introduced two novel tasks in which motor planning developed intrinsically. We separated this continuous self-paced motor planning statistically from motor execution by experimentally minimizing the repetitiveness of the movements. Thereby, we found that in the rat sensorimotor cortex, neuronal motor planning processes evolved with slower dynamics than movement related responses both on a sorted unit and population level. The fast evolving neuronal activity preceded skilled forelimb movements while it coincided with movements in a locomotor task. We captured this fast evolving movement related activity via a high-pass �lter approach and con�rmed the results with optogenetic stimulations. As biological mechanism underlying such a high pass �ltering we suggest neuronal adaption. The differences in dynamics combined with a high pass �ltering mechanism represents a simple principle for concurrent motor planning and execution in which planning will result in relatively slow dynamics that will not produce movements.


Main Text
The motor system is one of the major output channels of the brain.Since there is cascade of areas converting sensory inputs to a motor output 8 it is di cult to obtain control over the motor output via experimental settings.A certain degree of behavioral control can be achieved by training animals to respond to sensory cues 9 .With proper controls one can tease out planning and sensory effects in the neural activity 8,10,11 .Nevertheless, it is for example di cult to separate the neural activity caused by the sensory go cue from the neural activity causing the movement itself 12 .Similarly it is di cult to exclude the possibility of a simultaneous planning and execution: although planning can be separated from execution by introducing a delay phase, it may not be possible to separate a planning that occurs simultaneously with the execution.That is, whenever there is a movement execution command, there may be a super positioned sensory, reward, and planning coding 13 that makes it hard to detect and understand the underlying motor command.A solution to the sensory distortion is based on self-initiated movements 14,15 .To minimize the contribution of a planning component on the executional activity we note that planning can be separated from execution in terms of the lag between the neural activity in the movement 16,17 .Here, we consider neuronal activity with a temporal lag to the behavior in the order of a previously suggested range of less than 100 ms 18,19 as being related to motor execution.We refer to neuronal activity with larger temporal lags to the behavior as motor planning or sensory integration, depending on whether the neuronal activity occurred before or after the movement.This lag-based interpretation of neuronal processes is hampered by behavioral correlations.If a movement is correlated over time (e.g. because a certain pattern is repeating across time), neuronal activities related to both planning and execution processes will appear to be correlated to the behavior even if a causal relationship only exists for one of the processes.A repetitive movement would cause an autocorrelation with multiple peaks (see illustration in Fig. 1A), whereas a prolonged behavioral state, due to reward delivery or planning, may cause one broader peak which we refer to as temporal bleeding (see illustration in Fig. 1B), respectively.

Minimally repetitive movement tasks
To reduce this temporal bleeding, we aimed to minimize correlations by encouraging animals to conduct movements with minimal reoccurrence of individual movement sequences.In the locomotor task, rats moved unconstrained in a box while searching for pseudo-randomly placed water drops on a oor mesh (Fig. 1C).In this task neither the overall movement (Fig. 1SA) nor the directedness of the movement was changed across sessions (Fig. 1SB).In the joystick task, rats were trained to move a joystick with their right front paw while minimizing revisiting previously visited positions (Fig. 1D).In this task the overall movement increased across sessions (Fig. 1SA) and rats learned to explore the anterior posterior movement direction in later sessions (Fig. 1SB).Only recordings after 70 hours of training were used for data analysis.In both tasks, movements were not repetitive as indicated by the narrow temporal behavioral autocorrelations of the movement velocities (see data boxes in Fig. 1C and D).
To study the neuronal underpinnings of decorrelated movements, we trained six Long-Evans rats in the locomotor task.Five of these animals were also trained in the joystick task.To record neuronal activity, electrodes were placed bilaterally in the sensorimotor cortex (42 electrodes per animal, Fig. 1E).We targeted the output layer V by implanting the electrodes at a depth of 1.2 mm 20,21 .In total we recorded 5400 single units (SU) and 6876 multi units (MU) over 100 sessions for the locomotor task (Supplementary Table 1) and 1217 SU and 1659 MU over 25 sessions for the joystick task (Supplementary Table 2).We refer to SU and MU collectively as sorted units.
We rst examined weather the movement decorrelation showed up in the statistics of the neuronal activity.For repetitive behavior, neurons may re at a speci c lag relative to each other, rendering some lags less represented than others.This causes the ring rate for some lags to be fundamentally lower than the average ring rate (see dashed lines in Fig. 1C and D).Here, the neuronal activity was characterized by a decorrelated pair-wise spiking, i.e. pairs of neurons red independently of each other such that all lags were represented equally, and the ring rate at a certain lag was close to the average ring rate.The ring rate of one neuron relative to another neuron at the least represented lag was 94 ± 13% and 88 ± 12% of the average ring rate in the locomotor and joystick task, respectively (Fig. 1C and D, see methods) indicating a decorrelated neuronal activity.

Temporal precision
The temporal decorrelation of both the behavioral and the neuronal activity maximizes the temporal precision of the estimated functional relation between movement and neuronal activity.To quantify the temporal precision, we calculated the range of temporal lags for which a given sorted unit was modulated by the paw velocity (Fig. 1F and G).We refer to this modulation across lags as velocity modulation (Fig. S2) and the duration for which the velocity modulation exceeded 80% of the peak modulation we refer to as the modulation duration.We observed units with both long modulation durations (locomotor task: 1.6 ± 0.37s, joystick task: 1.2 ± 0.37s) and short modulation durations (locomotor task: 0.36 ± 0.09s, joystick task: 0.27 ± 0.06s) within the same session (Fig. 1H and I).This demonstrates that our approach minimized behavioral bleeding to the extent which allowed separating long processes, like motor planning and sensory integration, from shorter processes like motor execution.
Finally, this behavioral approach enabled us to quantify the relative strength of motor planning and sensory integration by taking the normalized difference of the velocity modulation for negative and positive temporal lags.In line with previous lesion and inactivation approaches [22][23][24][25] , the relative contribution of the motor planning related activity was larger for the joystick task (9.3 ± 2.8%, mean ± SEM, p=0.0007, two-tailed t-tests) whereas the sensory integration related activity was larger in the locomotor task (-4.3 ± 1%, mean ± SEM, p<0.0001, two-tailed t-tests, Fig. 1J and Fig. S1C).For the joystick task, the motor planning related activity increased relative to the sensory integration related activity for later training sessions (Fig. 1SC).Thus, our approach based on minimal repetitive movements complements previous studies with a temporally re ned neuronal activity based assay of the gradient from motor planning and execution to sensory integration for skilled and locomotor behavior.

Varying neuronal modulation durations
For the example units in the joystick task we noted that the velocity modulation increased earlier for units with longer velocity modulations compared to units with a short velocity modulation (Fig. 1G).This led us to examine whether the modulation duration across units was independent of the temporal lag (Fig. 2A, upper panel), or whether the modulation duration across units increased with larger temporal lags relative to the movement (Fig. 2A, lower panel).Here we de ned the temporal lag based on the peak of the velocity modulation (see methods).In accordance with the second hypothesis, the modulation duration increased signi cantly with increasing temporal lags for both locomotor and joystick tasks (ANOVA, locomotor task, p<0.0001,ANOVA joystick task, p<0.0001,Fig. 2B and C).The longer velocity modulation for larger lags is not due to a larger temporal scatter since the variability of the velocity modulation was not increasing with increasing temporal lag (Pearson correlation, locomotor task, p>0.05, joystick task: p>0.05,Fig. S3A).To test whether, the slower dynamics (indicated by longer modulation durations) were the result of slow balancing head and shoulder movements, we calculated the neck velocity modulation duration in the locomotor task.Neither was the average neck velocity modulation duration larger than that of the paw movements (Fig. S3B), nor was the peak of the neck velocity modulation earlier than that of the paw movements (Fig. S3C).Thus, we can exclude that slower neuronal dynamics relied mainly on neck movements.This suggests that a putative motor execution represented by units with shorter temporal lags occurred with faster neural dynamics than motor planning and sensory integration.

Integration timing of cortical areas
If motor planning and sensory integration is associated with longer modulation durations, it is conceivable that a higher brain area, such as secondary motor cortex (M2, putatively functionally similar to premotor cortex in primates 26,27 ) contains neurons with longer modulation durations than primary motor cortex (M1).To test this, we mapped the electrode locations on to the non-linear gradient spanning M2, M1, and primary somatosensory cortex (S1) (Fig. 1E).Indeed, neurons in higher areas (i.e., M2) had a signi cantly longer modulation duration than neurons in lower areas (i.e., M1 and S1, Fig. 2D).This was true for both the locomotor and the joystick task (ANOVA, locomotor task: p<0.0001,Linear mixed effect model: S1 vs M1, p=0.

Population activity changes faster during movement
Next, we examined whether the neuronal activity changed faster during movement execution than during putative motor planning and whether this change was particularly fast during trained behavior, such as the joystick task.Since the spiking activity of individual units contained a large variability, we tested the rate of change in terms of the population activity (Fig. 3A and B).To this end we correlated the population activity (across all sorted units in one session) between two time points of various temporal distance.This population correlation will typically decrease with increasing temporal distance between the two time points.The rate of decay was quanti ed by the time constant of an exponential t.This population correlation decay is a measure of the frequency characteristics of the population dynamics: one over this time constant de nes the frequency for which a low pass lter with that time constant attenuates the amplitude to 16% of the original amplitude.
To compare the time constant during movement and behavioral quiescence, we de ned trials between the time point of lowest paw velocity which we refer to as premovement and the time point of highest paw velocity which we refer to as movement (see methods, Fig. 3C and D).While the population correlation followed a similar motive with a less con ned diagonal during premovement and a more con ned diagonal during movement, robust bands of low correlation during movement execution only occurred in the joystick task, but not in the locomotor task, thus revealing a qualitatively different correlation structure (Fig. 3E and F).These bands of low correlation are a sign of a short time constant, indicating that the population activity changed rapidly during motor execution.
During periods of movements, population correlations decayed signi cantly faster than the median time constant in the joystick task (-176±59 ms, mean ± SEM, n=5, p=0.043, two-tailed t-tests) but not in the locomotor task (-18±27 ms, mean ± SEM, n=6, p=0.54, two-tailed t-tests, Fig. 3G and H).In line with the strong decrease in time constant in the joystick task during movements (Fig. 3I), the time constant during joystick movements was lowest (203±88 ms, mean ± SEM, n=5, Fig. 3J) indicating a faster changing population activity.In contrast, the time constant was largest (i.e. the population activity was stable) during joystick premovement periods which putatively involves motor planning (761±375 ms, mean ± SEM, n=5, Fig. 3J).The difference in the time constants cannot be explained by behavioral differences across the two tasks (summarized in Supplementary Note 1, Fig. S4).Across areas, the time constant only fell below the baseline level for S1 for the locomotor task (although this drop was not signi cant), and across all areas, S1, M1, and M2 for the joystick task (Fig. S5).Finally, to rule out the possibility that the observed frequency gating was only valid for fast movement changes, we tested how the time constant depended on the instantaneous frequency of the movements (see methods, Fig. S6).The decrease in correlation followed an exponential decay for both the locomotor task and the joystick task, indicating that the time constant is a good proxy for the frequency content of the neural dynamics.
For the joystick task, apart from a small increase for the lowest movement frequency, the neural time constant was short and independent on the movement frequency (t = 0.32 to 0.4 s), whereas for the locomotor task the neural time constant was longer (t = 0.66 to 0.69 s) and only decreased for the highest movement frequency (t = 0.36 s).We speculate that this independence of the movement frequency for the trained joystick task was due to the required signaling to the spinal cord that had to overcome the same movement threshold independent on whether the movement was fast or slow.For a non-trained task such as the locomotor task the neuronal frequency was in general lower and may therefore have less in uence on the spinal cord.
The faster decay in the joystick task compared to the locomotor task corroborates the idea that fast processes are mainly involved in movement execution.Here we refer to the nding that the joystick task involved a trained component (see Fig. S1).Behaviors relying on training typically require the participation of motor cortex 22 .This is in line with short velocity modulations associated with faster changes for processes that start immediately before the movement and are thus related to the movement execution.In contrast, the slowly changing activity in the locomotor task which relies less on the participation of motor cortex 28 , may be related to a mix of planning, execution and sensory signals.This is in line with longer velocity modulations associated with slower changes for processes that start well before movement like planning.

Fast changes in neuronal activity precede movement
Next we examined whether a fast changing neuronal activity preceded movement execution (Fig. 4A).
Paw velocities provide a general measure of movement magnitude independent of speci c types of movements.To allow a comparison of the discretized and typically low frequency spike trains of sensorimotor cortex with the continuous paw movements, we reconstructed the continuous subthreshold activity with a resolution of 10 ms from the spiking activity 29 (Fig. 4B).This allows the detection of neuronal activity changes which are faster than those signaled by low frequency spiking events at the same time as it minimizes the high-frequency transients that each spike constitutes.Fast changing activities typically preceded large paw velocities (Fig. 4C).To quantify the relation between the neuronal frequency and paw velocity, we calculated the Pearson correlation coe cient between paw velocity and the recti ed bandpass ltered neuronal activity (averaged across neurons) with center frequencies ranging from 0.1 to 11 Hz (Fig. 4D).The correlation was highest for 2.3 Hz for the joystick task and highest for 1.1 Hz for locomotor task (Fig 4E).For the joystick task, the correlation reached its maximum at a small negative lag for high frequencies (Fig 4F ), whereas the peak for the locomotor task did not signi cantly precede the movement for any frequency band.A similar result was achieved without reconstruction for non-sorted neuronal data for which the thresholded spikes were pooled (Fig. S7A-C).
Thus the peak correlation and lag was consistent with a movement execution function only for high frequencies.
Frequency speci c decoding of paw movements Next we investigated how slow and fast neural activity could be used to decode paw movements (Fig. 5A  and B).Low-pass ltering results in smoothing and accumulation of more spikes over time leading to a reduced noise level in low-pass ltered signals compared to high-pass ltered signals.To minimize such a frequency speci c bias on the decoding performance, we conducted the decoding on de-noised neuronal activity.To this end we tted a linear model to the neural activity of each sorted unit by encoding the X and Y paw velocity using a temporal kernel with 401 weight parameters (-2s to +2s lags in 10 ms bins) per direction giving a total of 802 parameters.To avoid that the decoder predicted the correct paw velocity by simply inverting the encoded paw velocity, the decoder only had access to a fraction of the time points.We used two weight parameters for each velocity direction, x and y.The two weight parameters were located at lag 0 and at lag de ned by one over the band-pass frequency.The decoding performance was highest for a frequency of approximately 2.3Hz (Fig. 5C and D and Fig. S8A).By adding Gaussian white noise to the de-noised neuronal activity we could reproduce the lower optimal decoding bandpass frequency for the raw neuronal data.To summarize, this suggests that de-noised neural activity can be used to investigate the frequency contribution to decoding and that a frequency of around 2.3 Hz is optimal for decoding paw velocities.
To investigate which neuronal frequency features the decoder used to predict the paw velocity we applied a wavelet analysis of the unit speci c decoding kernel for the raw spiking neural activity (Fig. 5E-F).The neuronal frequency ramped up from 0.7 Hz (black outline in Fig. 5E and F), one second before the movement, to 12-24 Hz around 100 ms before the movement onset.In the period 100 ms before the movement, frequencies above 3 Hz had a signi cantly stronger amplitude for the joystick than for the locomotor task (Fig. 5G and Fig. S8B-D).Since the decoding kernel was the result of an average across multiple trials/time-points it is conceivable that the slow component could be the result of the average of multiple temporarily jittered high frequency components.If this was the case the variability of the kernel weights would be increased during the low-frequency periods (Fig. S9).However, the variability of the kernel weights were not larger during the low-frequency period than during the high-frequency (see inset Fig. 5E-F), indicating that the low-frequency component was not a result of averaging multiple high frequency trials but rather evident as a low frequency component on the single trial/time-point level.
Since a frequency increase corresponds to an increase in the temporal derivative we examined at which time point the recti ed temporal derivative was the largest for each kernel for each sorted unit (Fig. 5H).For the locomotor task those time points were more uncertain in time than for the joystick task (Fig. 5I).
To quantify these rise times we calculated the time point when the kernel reached 50% of the maxima (or minima) (Fig. 5J).The temporal focusing and the relatively high neuronal frequency for the joystick task may conserve the speed of change of the neural signal when signals from multiple neurons converge on subcortical structures (Fig. 5K-L).Such a temporal focusing may ensure that the high frequency change in the cortical neural activity will be reliably propagated towards the spinal cord.

Frequency content predicts population state
Since previous work has separated planning and motor execution in terms of a population code 3 we asked if the frequency code could predict this population coding.The tuning of the paw velocity (Fig. S10A and B) was correlated to the change in population code when traversing from motor planning towards motor execution (Fig. S10C).Since the correlation between the population velocity tuning at planning lags (-1000 to -200 ms) and at execution lags (-40 ms) was minimal we regarded the population velocity tuning at -40 ms to represent the output potent space.The space orthogonal to this was regarded as the output null space.Indeed, the part of the trajectory that corresponded to high frequency coding was typically associated with high paw velocities and represented the output potent space.In contrast, the part of the trajectory that corresponded to low frequency coding was typically characterized by low paw velocities and lied in the output null space on a single sessions level (Fig. 6A.Fig. S10D) as well as in an across session average (high frequency coding: p=0.0043,Bonferroni corrected, n=929, low frequency coding: p< 0.00001, Bonferroni corrected, n=579, Fig. 6B).Thus the frequency coding can predict population code indicating that frequency coding may be an integral part of movement control which might represent the underlying biological explanation of the population code theory.
Since it is conceivable that slow frequencies related to planning could be governed by the (long range) input to the population rather than the local activity, we calculated the coherence between the local eld potential and the spiking activity for different frequencies during putative planning periods and executional periods (Fig. S11A and B).The planning period was de ned as the 2 seconds before trial onset, and the executional period was de ned as the 2 seconds after the trial onset (see Fig 3C).The data suggested a decrease in the coherence for low frequencies.The coherence for lower frequency was stronger for the planning period than for the executional period, a relation that was inversed for the higher frequencies.This supports the hypothesis that the execution is a fast signal that has a local origin and that planning is a slower signal with a more distributed origin.

High frequency optogenetic stimulation evokes movements
Next we optogenetically induced brain activity in the primary motor cortex at different frequencies to examine whether a certain frequency was more prone to evoke paw movements.We tested ve different frequencies 0.1, 0.3, 1, 3, and 10 Hz.To minimize the effect of harmonics, the light was varied according to a sinusoidal.To test whether slow oscillations induced a depolarization block, we measured extracellular activity in close proximity to the optical ber (Fig. 7A and B).All stimulation frequencies resulted in a strong increase of neuronal ring.However, in line with our high frequency hypothesis, only 3 and 10 Hz resulted in an overt cyclic paw movement (Fig. 7C and D, supplementary movie 1, average number of behavioral cyclic paw movements for 3 Hz stimulation was 2.3±0.5 Hz, and for 10 Hz stimulation was 3.4±1.4Hz).This movement threshold between 1 and 3 Hz is in line with the fact that movement generation was associated with a time constant of 400 ms (Fig. 3J) which in turn corresponds to a 2.5 Hz, and since the peak in the correlation between paw velocity and neuronal activity occurred at above 1.1 Hz (Fig. 4E).

Discussion
Based on two tasks that encouraged animals to conduct minimally repetitive movements, we found that fast changes in neuronal activity were related to motor execution.These fast changes in neuronal activity were more pronounced during the joystick task than during the locomotor task.Furthermore, higher frequencies in the neuronal activity preceded the movement by 100 ms in the joystick task, whereas it coincided with the movement for the locomotor task.This is in line with the fact that the locomotor task required no training (Fig S1 ) and that locomotion may be dominated by an efference copy signal in the neuronal activity 25,30 .In contrast, the joystick task required training (Fig S1 ) and lesioning and inactivation studies have shown that skilled movements are more dependent on the motor cortex [22][23][24] .
Here we showed that lower frequencies were decoupled from movement suggesting that they were more related to motor planning and sensory integration.Movement decoupled activity avoided the high frequencies underlining the general role of the fast changing neuronal activities in motor cortex for movement execution.Such a fast changing population activity can be extracted by a classic high pass lter.Fast changes refer to e.g.changes from a high ring rate to a low ring rate, or vice versa.
Adaptation mechanisms [31][32][33][34][35] at any stage between the cortex and the muscles could serve as the biological equivalent of such a high pass lter (see Supplementary Note 2).As a direct test of our frequency hypothesis optogenetic stimulation only resulted in movements when applied at su ciently high frequencies.
The here proposed frequency based separation of motor planning and execution can be integrated into conceptual frame works of motor control.According to the concept of dynamical systems, e.g. the nullspace theory 3 , the frequency based separation of motor planning and execution would allow both processes to work in parallel.So far the null-space theory was tested with trial structures with temporally separated planning and execution periods 6 or with sensory driven motor execution 9 .For intrinsically planned continuous movements, our results suggest that two independent population state spaces can be generated in the frequency domain, one based on high and one on low frequencies.The concept of separate neuronal populations for motor execution and motor planning (e.g. by genetically or projection de ned neurons 1,2 ) assumes a complete separation of the signals.However, genetically de ned spinal cord projecting neurons have been shown to not only encode motor execution but also motor planning 2,7 .
Our proposed high-pass ltering mechanism could be a way to expose the motor execution component by decreasing the planning component.This could explain why the fastest change of the spinal cord projecting neurons occurred after the go cue and that this change was faster than that of the thalamic projecting neurons 2 .Therefore, the separation of the processes by means of slow and fast dynamics could facilitate simultaneous parallel motor planning and execution within the same neuron, be it in the conceptual framework of dynamical systems or based on identi ed neuronal subtypes.
The separation of motor planning and execution by means of different frequencies of neuronal activity requires that motor planning evolves relatively slowly.This prerequisite is reasonable, as planning and decision making rely on accumulating internal or external evidence [36][37][38] .Thus, motor planning-related neuronal activity changes slowly and hence can be stopped from percolating to the muscles by a high pass ltering mechanism based on neuronal adaptation.Thus, our proposed mechanisms is able to explain in a very simple manner the simultaneous implementation of intrinsic motor planning and execution.

Animals
All animal procedures were approved by the Regierungspräsidium Freiburg, Germany.In this study we used six male Long Evans rats (400 g, Janvier) which were implanted at the age of eight weeks and recorded up to four months after the implantation.Three to four animals were pair-housed in type 4 cages (1500U, IVC typ4, Tecniplast, Hohenpeißenberg, Germany) before implantation and the animals were single housed after the implantation in type 3 cages (1291H, IVC typ4, Tecniplast, Hohenpeißenberg, Germany) under a 12 h light dark cycle (dark period from 8 a.m. to 8 p.m., time span of training and experiments).Prior to the rst behavioral training, no behavioral tests were conducted, no drugs were applied and food (standard lab chow) and water were provided ad libitum.During the course of the experiment, the animals were maintained with free access to food but water supply was restricted.Rats were kept at > 80 % body weight as measured prior to water restriction.For 2 days per week, free access to water was ensured.

Animal surgery
Animals were initially anesthetized with iso urane inhalation followed by intra-peritoneal injection of 75 mg/kg Ketamine (Medistar, Holzwickede, Germany) and 50 mg/kg Medetomidin (Orion Pharma, Espoo, Finland).The animals were then put into a transportation container covered with an opaque cloth to facilitate the anesthesia.Once the animals were anesthetized, they were positioned in a stereotaxic frame (David Kopf Instruments, Tujunga, CA, USA) and their body temperature was kept at 36 °C using a rectal thermometer and a heated blanket (FHC, Bowdoin, USA).The anesthesia of the animals was maintained with approximately 2% iso urane and 0.5 l/min O2.For pre-surgery analgesia, we subcutaneously (s.c.) administered 0.05 mg/kg Buprenorphine (Selectavet Dr. Otto Fischer GmbH, Weyarn/Holzolling, Germany).Every other hour, the animals received a s.c.injection of 5 mL isotonic saline.Moisturizing ointment was applied to the eyes to prevent them from drying out (Bepanthen, Bayer HealthCare, Leverkusen, Germany).The skin was disinfected with Braunol (B.Braun Melsungen AG, Melsungen, Germany) and Kodan (Schülke, Norderstedt, Germany).To perform the craniotomy, the skin on the head was opened along a 2 cm long incision using a scalpel.The exposed bone was cleaned using a 3% peroxide solution.Self-tapping skull screws (J.I.Morris Company, Southbridge, MA, USA) for reference for extracellular recordings were placed over cerebellum.Craniotomies were drilled bilaterally extending from -2 to +5 mm in the anterior posterior direction and from +1 to +4 mm in the lateral medial direction relative to Bregma.22 tungsten electrodes (200 to 600 kOhm impedance, polyimide insulation, WHS Sondermetalle, Grünsfeld, Germany) were implanted at a depth of 1.2 mm in each hemisphere.Electrodes were implanted according to the area borders given by the online brain atlas from Matt Gaidica 40 and CFA and RFA was delineated according to Neafsay and Sievert 41 , and Rouiller et al 42 (Fig. 1E).Three rows of 6 electrodes each, oriented in the medial-lateral direction, were implanted in the anteriorposterior direction.The fourth and last row consisted of 4 electrodes, oriented in the medial-lateral direction (see Fig. 1E).Occasionally, we had to cut some electrode wires, in order to not destroy blood vessels at the implantation site (e.g., rat 221, left hemisphere, last electrode row).Kwik-Cast (WPI, Sarasota, FL, USA) was used to protect the brain from the dental cement applied in the nal step.Before, Mill-Max connectors (Mill-Max, Oyster Bay, USA) from each hemisphere were glued together to form a 4 x 13 pin connection matrix.The last and rst four pins were connected to the two skull screws over cerebellum to serve as reference and ground.Finally, the assembly was xed using dental cement (Paladur, Kulzer GmbH, Hanau, Germany).

Behavioral tasks
Animals were encouraged to move with as little repetition as possible.In the locomotor task, two servo motors positioned a waterspout at different locations within an arena of 30×40 cm.Every 10 to 30 s a valve ejected a drop of water, which remained in the mesh until the rats consumed it.To prevent the rats from following the movements of the waterspout, we introduced dummy moves: First the waterspout was doing a dummy move without giving water.One second later it did move to a new position where it let out a water drop.The third and last move was again a dummy move.Even for an experienced animal, this procedure resulted in multiple water drops distributed across the mesh at any given time point.The fact that the rats did not collect all water drops indicates that the animals could not predict where the water was let out and had to actively search for it.This task required minimal training as indicated by the stable paw velocities over all sessions.Thus, we used all sessions for data analysis (Supplementary Fig. 1A).
In the joystick task, the animals had to learn to grab a joystick-like manipulator as a rst step.The manipulator was based on a manipulandum for rodents 43 .Instead of having to reach out for the joystick, the joystick was placed right below the right front paw.The naïve rats typically explored the arena in which the joystick was placed.As the animals placed the paw by chance on the joystick, the joystick vibrated and a liquid reward was given as long as three requirements were met: (1) The rats had to keep holding the joystick with the right front paw which we controlled for via force sensors on the joystick.( 2) The left front paw had to be placed on a force sensor plate, which was placed to the left of the joystick.
(3) The rats' head had to cross an infrared sensor.This ensured that the animals had to learn to use their right front paw to manipulate the joystick rather than the left paw or the mouth.The vibration of the joystick was implemented by clamping the current of the two motors according to two independent Gaussian processes and served two purposes: (1) it made the animals aware of the joystick.(2) The vibration of the joystick increased in amplitude during the course of 10 s (the maximum vibration amplitude resulted in an average acceleration of 1.5m/s 2 ) such that, unless the animals held the joystick rmly, it would lose the grip and thus not receive rewards.Together, these measures resulted in an automatic training by which the rats learned to hold the joystick during the maximum vibration amplitude within 10 sessions.Once the rats had developed a rm grip of the joystick, the motors were turned off and the rats received a reward when they actively moved the joystick.Moreover, the rats only received rewards when they moved in a direction or to a position which had not been visited recently (see below).The joystick could be moved within an arena of 40x40 mm.This arena was divided into 5×5 bins and the direction of movement was divided into 8 bins.For each bin we stored the amount of remaining reward.Whenever the rats visited one bin, the amount of remaining reward, r, in that bin was decreased to r-Dr.
The amount of reward that was decreased, Dr, was distributed among all other bins.Thus, if the rats preferred one bin, the reward within that bin disappeared completely after 20 seconds.It took up to 15 sessions for the animals to start to move the joystick non-repetitively (Supplementary Fig. 1B).Before the rats started to move randomly, they typically tried to pull the joystick only in one direction (typically towards the rat).This resulted in minimal overall movements since the joystick was stopped by the edges of the arena (the 40x40 mm arena).Only when they realized that they could move in all different directions, the amount of total movement increased.For data analyses, we used data from sessions 15 to 35.

Quantifying behavior
Since the rats had to take a de ned pose in the joystick task, we could relate the joystick position and movement to the egocentric coordinates of the rat.To enable a comparison of the locomotor task and the joystick task, it was necessary to quantify the behavioral variables in a similar way.To achieve an egocentric tracking in the locomotor task, we tracked the paws, head, chest, and belly of the animals.By using the head, chest, and belly coordinates, we aligned the movements of the right front paw to egocentric coordinates.The neck velocity was calculated from the head, chest and belly coordinates.Those body parts were tracked by painting them in different colors.The head of the rat did not have to be painted because of the black hood of Long Evans rats.To ensure that all body parts could be tracked, the cameras were placed below the arena.Two to four cameras (Stingray, F033C IRF CSM, Allied Vision Technologies) were used in the locomotor task.The noise of tracking was estimated to 0.79 cm/s (estimated when the paw was standing still on the mesh) and was subtracted from the paw velocity estimates.

Data acquisition and preprocessing of extracellular recordings
Extracellular signals were bandpass ltered, ampli ed and digitized using the INTAN (Intan Technologies, Los Angeles, California) head stage attached to the Mill-Max matrix connector at the head of the animals.
To maximize comfort for the animals, we stripped the ultrathin INTAN cable and suspended it with a 1.5 m long ultralight spring with a 1.5 mm diameter.The long recording cable allowed the rats to move between the locomotor task and the joystick task without having to be disconnected and re-connected.The rats could either begin with the locomotor task and after 30 min a door was opened allowing the rats to walk into the joystick arena for 40 to 90 minutes, or the rats were in the joystick arena for the entire session.In case of a dual task session, we always began with the locomotor task, because the color markers used for the locomotor tracking faded over time.
The extracellular recordings were sampled at 30 kHz and were de-noised o ine.First, 50 Hz and the corresponding harmonics were removed using a 20 ms template estimation.The activity across all channels was demeaned using a median lter.Spike sorting was conducted on high-pass ltered data with a cut off frequency of 300 Hz.Spike snippets were extracted from peak aligned events that crossed a threshold of four times the standard deviation.Only spikes with a negative peak were taken into account.The spike window was -0.5 to 2 ms around the peak amplitude (resulting in 76 values for each spike).To minimize the risk that a sorted unit was a combination of multiple neurons, we applied a conservative threshold for the cluster size.To this end we used a cluster size that was dictated by the noise level half a millisecond before the minimum of the spike.Given the typical refractory period of neurons, this noise estimate excluded variability caused by this unit and was therefore a direct measure of the cluster size of this particular unit.Since our electrodes typically had a spacing between 300 and 1000 µm, we sorted each electrode separately.The spikes were sorted in the raw 76 dimensional space without dimensional reduction.For each sorted unit, the spike sorting algorithm had two phases.First, the algorithm estimated a suitable seed spike.Second, the corresponding waveform was optimized iteratively until the spike assignments of that unit remained constant.The clustering algorithm selected a seed spike by calculating the average noise level across all units.Afterwards, it randomly chose one spike and counted the number of neighboring spikes within this average noise level.Those spikes were called the spike-neighborhood.This procedure was repeated for 500 randomly chosen spikes in order to maximize the chance of nding a globally optimal seed spike.The spike that had most neighbors was selected as the seed for a unit.In order to optimize this spike seed, the noise level for the neighboring spikes was recalculated, the new neighborhood was calculated given this new noise level, and the new average waveform was calculated.This procedure was repeated until the neighborhood remained constant.The spikes within the noise-de ned neighborhood were considered to belong to one sorted unit.For this unit, the spike sorting was nished at this point and it was not considered for further spike sorting.For the remaining spikes, the algorithm re-started phase one and two in order to search the next sorted unit.This procedure was stopped when it resulted in sorted units with spike rates lower than 0.1 Hz.
We regarded a unit as a single unit when the number of spikes within an inter-spike interval of less than 2 ms corresponded to a smaller ring rate than the average ring rate of the unit.To de ne the degree of decorrelation across neurons, we used the m-rate 29 .The m-rate denotes the minimum spike rate in the spike-triggered spike average between two neurons (cross correlogram).The cross correlogram was calculated over a period of -10 to 10 s with a 10 ms binning.We did not calculate the m-rate from a neuron to itself since that would re ect intra-neuronal processing (adaptation and refractory period) rather than the decorrelation of the population.The m-rate corresponds to the average spike rate if the spikes of the two neurons occur independently of each other, and the m-rate would be 0 for the case of a lag with no corresponding spike pairs.The m-rate percentage was calculated by dividing the m-rate with the average ring rate.

Single and multiunit velocity modulation
As a general way to relate behavior to neural activity on a single unit or multiunit level, we used a generalized form of spike triggered average of the paw velocity, which we denote as activity weighted distribution (AWD).First, instead of taking discrete spikes, we weighted the behavioral variable (paw velocity or position) with a continuous neuronal activity.Here this continuous activity was the instantaneous ring rate smoothed with a Gaussian kernel with a standard deviation of 50 ms.Second, instead of averaging the behavioral variable, we calculated the distribution for the behavioral variable.A distribution was formed by binning the complete velocity range into 10 equally sized bins.Each bin quanti ed the average activity across the velocity range of the corresponding bin (See Supplementary Figure 2).In contrast to the linear average in the classical spike triggered average, the distribution of the behavioral variable allowed us to take nonlinearities into account, e.g.exponentially increasing ring rates with linearly increasing velocity.According to a traditional spike-triggered average, the relation between neuronal activity and behavior was calculated at different temporal lags between neural activity and behavior.Here we used lags between -4 and 4 s with a temporal resolution of 10 ms.For large delays beyond 3 s, the neuron was typically no longer modulated by behavior.Here we used the average activity between 3 and 4 s to calculate a baseline activity.This baseline activity was subtracted from the AWD.
The average velocity modulation at each lag was calculated by taking the mean of the absolute value of the subtracted AWD (Fig. 1F and G).The duration and the lag of the modulation was calculated by rst extracting the peak modulation.Then we traced this modulation backward and forward in time until the modulation was less than 80% of the peak modulation.The temporal difference between those two time points was de ned as the duration of the modulation (Fig. 1H, 1I, 2B, 2C, and 2D).The average between those time points was denoted as the temporal lag of the modulation.We took the average time of the 80% start and stop time since this resulted in a more accurate estimation than the peak time.This was due to the frequent occurrence of plateaus in the velocity modulation.During these plateaus, small uctuation of the neuronal signal within the noise level can make the peak appear at any time point along the plateau.To determine if a unit was modulated by velocity, we calculated the mean and standard deviation of the velocity modulation at the two extreme lags of the normalized velocity modulation (-4 to -3 s and 3 to 4 s).The normalized velocity modulation was calculated by subtracting and dividing the velocity modulation with the mean and standard deviation, respectively.A unit was regarded as modulated if this velocity modulation was larger than 10 (a.u.).The variability of the velocity modulation was calculated by dividing the ring rate variance with the average ring rate in each bin of the lockup table that is used to calculate the velocity modulation (See Supplementary Figure 2).The normalized variability for each sorted unit was calculated by dividing with the variability at the baseline interval (-4 to -3 s and 3 to 4 s).

Bootstrapping velocity modulation
To estimate the variability of the modulation duration we used a bootstrap analysis (Fig. 1H and I).Since it would be computationally ine cient to sample from all 10 ms bins with replacement and since 2 neighboring 10 ms bins were not independent, we chose to divide each session into 100 segments of equal size and to calculate the AWD for each such segment.This resulted in segments that were at least 10 seconds long, allowing computationally effective bootstrap sampling.We sampled the corresponding 100 AWDs with replacement and calculated the resulting velocity modulation.This procedure was repeated 100 times.For each repetition, we calculated the modulation duration.Afterwards, we calculated the standard deviation across those repetitions.

Population correlation analysis and trial de nition
The population correlation analysis was performed on normalized neural activity.For each unit, we divided the spike trains into 10 ms bins, subtracted the average ring rate and divided each bin by the standard deviation of the binned activity.This normalized data was organized into a matrix with as many rows as there were units and as many columns as there were time bins.To prepare the data for the correlation, we normalized each column to have an average of 0 and a Cartesian norm of 1 (unit length).
Finally, we removed a global population activity that could otherwise bias the correlation analysis.During short periods of time (between 500 ms to 10 s) sometimes the animals suddenly froze (both in the joystick and the locomotor task) which resulted in a correlated population activity across the joystick and the locomotor task (average R=0.5).Since this activity was correlated across two fundamentally different tasks, it was more likely to re ect a global state change rather than a planning process, which in turn could bias the population correlation.Therefore, we minimized the contribution of this freezing related population activity, p, by correlating the population activity at each time bin, a t , with the population activity, and subtracting the population activity according to this correlation: a t -p(a t *p), where * is the scalar product.
With this normalized activity, we calculated the scalar product (Pearson correlation coe cient) between two population vectors at 2 different time points (Fig. 3C and D).We only correlated population vectors within a trial.Since our behavioral data was not separated into de ned trials, we constructed trials using the paw velocity.First, we ltered the paw velocity with a Gaussian kernel of 2 s full width half maximum (FWHM).To nd trials for which a period of low behavioral activity was followed by a period of high behavioral activity, we divided each time point in the ltered velocity by each time point in the ltered velocity 2 s earlier.If this ratio was larger than 2 and if this ratio was a local maximum across time, this was regarded as the central time point of a trial.A trial was then de ned as 8 s before and 8 s after this maximum.This resulted in 1601 bins of 10 ms in one trial.The correlation was calculated between all 1601×1601 pairs of time points within a trial.Finally, as the population vector at one reference time point was correlated with the population vector at all other time points, the correlation would decay with increasing distances from the reference time point.This decay was tted by an exponential function using nonlinear optimization with a Gaussian cost function (Fig. 3E, F, G and H).This population correlation decay is a measure of the frequency characteristics of the population dynamics: one over this time constant de nes the frequency for which a low pass lter with that time constant attenuates the amplitude to 16% of the original amplitude.
To estimate the behavioral frequency at each time point, we calculated the maximum behavioral frequency (within a window that was inversely proportional to the frequency) that was required for describing the behavior within the error bounds of the tracking.

Behavioral impact on population correlation
To test how well the neurons encoded for position (Fig. S2B), we divided the egocentric x and y movement coordinates of the right paw into ve equally sized bins between the minimum and maximum position value.This resulted in a 5 x 5 element matrix.For each element in this matrix we calculated the average ring rate of the neuron when the paw was in the corresponding position within ±50 ms.We used this matrix as a lookup table to estimate the instantaneous ring rate at each 100 ms time bin, given the position at the corresponding time bin.The resulting time course of the ring rate was correlated to the time course of the true instantaneous ring rate binned in 100 ms bins.The same analysis sequence was conducted for x and y velocity.

Subthreshold reconstruction
The subthreshold reconstruction algorithm, SubLab, has been described in detail elsewhere 29 .In short, the algorithm uses the spikes of one unit (target unit) to reconstruct its subthreshold activity by means of the spiking activity of the remaining units (input units).The algorithm differs from recent auto-encoders and dimension reduction techniques in three aspects: (1) it does not assume an even distribution of spikes in time (Poissonian or Gaussian models); (2) (subthreshold) activity is not modi ed, as long as it does not cross the threshold; (3) the algorithm reconstructs the subthreshold activity individually per neuron and, therefore, does not impose any relation between units.Here we used 10 training epochs and we ran the reconstruction on complete sessions.
We also tested the LFADS auto-encoder algorithm, since it does not require a trial structure and since it can t complex dynamics to spiking data.For our data, LFADS smoothed the spike trains in a piecewise continuous way.We observed gaps in the smoothed spike trains.We suspect that these gaps were due to the spontaneous and complex behaviors, which in turn caused the internal states to be reset frequently.
The reconstructed activity was ltered in the following way (Fig. 4C, D, E and F).High pass ltering: First, the reconstructed signal was smoothed with a Gaussian kernel with a standard deviation (σ) of 0.14 s.
Using the cut-off frequency formula for Gaussian ltering (2πσ) -1 , this corresponds to a cut off frequency of 1.1 Hz.Second, we subtracted this smoothed signal from the original reconstructed signal.Band-pass ltering: First, the reconstructed signal was smoothed with a Gaussian kernel with a standard deviation of 0.057, 0.14, 0.28, 0.57, 1.4, 2.8, and 5.7 s (2.8, 1.1, 0.57, 0.28, 0.057, and 0.028 Hz), respectively.Second, we subtracted this smoothed signal from the original reconstructed signal.Third, the resulting signal was smoothed with a Gaussian kernel with a standard deviation of 0.014, 0.035, 0.071, 0.14, 0.35, 0.71, and 1.4 s (11, 4.5, 2.2, 1.1, 0.45, 0.22, and 0.11 Hz), respectively.Low pass ltering: The band-pass ltered signal that was ltered with a low-pass kernel of 0.71 seconds (0.22 Hz) and high-pass kernel of 2.8 seconds (0.057 Hz) was referred to as the low-pass ltered signal.The additional high pass ltering minimizes the in uence from strong low frequency components.Finally, to get the energy of the ltered signal, we calculated the absolute value of the high-pass ltered signal.

Relating population and frequency coding
Output-null and output-potent coding has traditionally been studied during the planning and execution phase of an instructed delay tasks.Since our behavioral setting does not include a typical trial structure, we de ned the planning and execution phase in terms of the lag between the paw velocity and the neuronal activity.To this end, the anterior-posterior paw velocity was multiplied with the neuronal activity for a sorted unit in a bin-wise manner for a given lag and averaged across all bins.Thus for a given lag, this approach will quantify how each neuron codes for the movement in a linear manner.We used temporal lags from -1 second to 1 second with 10 ms bins.The result is a N x 201 dimensional matrix for each session, where N is the number of sorted units.Dimension reduction to a 2x201 matrix was achieved by taking the largest two principal components.We de ned the output potent space as a onedimensional space covered by the vector between origo (0, 0) and the point in the two dimensional space (spanned by the rst two principal components) at lag of -40 ms.This lag was de ned by the notion that executional activity should have a small correlation to the planning activity, which in turn translates to the lag at which the correlation to the average activity between -1000 and -200 ms (putative planning activity) was smallest.We choose the upper limit to be -200 ms to minimize the bleeding into executional activity 18,19 .Since this de nition of the lag for the output potent space is maximizing the separation of planning and executional activity it is maximizing the chance that the null and potent spaces will be found.Such a biased de nition is justi ed here since the aim is not verify the null space theory but rather to see if it is related to the ratio of high and low frequencies of neuronal changes.The output null space was orthogonal to this output potent space.For each lag, we estimated which state the neuronal activity was closest to by means of the difference in magnitude: abs(output potent)-abs(output null).If this state tuning was positive we regarded the neuronal activity to be in the output potent state and if it was negative we regarded the neuronal activity to be in the null space.
To test if the frequency coding can predict whether the neuronal activity is in the output potent or output null space, we assigned the frequency preference for each lag of a certain session.This was done by calculating the difference in magnitude: abs(amplitude of high frequency) -abs(amplitude of low frequency).If this frequency tuning was positive, it means that the neuronal activity had a larger high frequency component and if it is negative it means that the neuronal activity had a larger low frequency component.We pooled all lags (across all sessions) that had a positive frequency (or negative frequency) tuning and calculated the resulting average state tuning.

Behavioral quanti cation during optogenetic stimulation
For optogenetic stimulation we used a 200 mm ber implanted at 1 mm depth in the primary motor cortex of two rats (511 and 512) (AP=0.5,LM=2, and DV=1).The viral vector AAV5 carrying the construct hSyn-hChR2(H134R)-eYFP-WPREpA (UNC vector core, Chapel Hill, NC, USA), was injected at a depth of 1.5 mm with a volume of 1ml.Each stimulation trial lasted 10 seconds and the light intensity was sinusoidally modulated according to one of ve frequencies: 0.1, 0.3, 1, 3, and 10 Hz with a peak power of 4-12mW at the ber tip.Since the current that ChR2 can give rise to is smaller for low frequencies than for high frequencies, we compensated with a stronger light intensity for the lower frequencies 44 .Each trial was randomly interleaved with 120 to 240 seconds.
To quantify the subtle paw movements that results from sinusoidal optogenetic stimulation (Fig. 6C), we rst calculated the paw position using FreiPose 39 .For a given trial we manually selected the camera with the clearest view of the right foot (the optogenetic stimulation was in the left hemisphere).The paw position for each frame was then projected to this camera and a 100x100 pixels window was cut out around this projected position.The optical ow was calculated for each pair of neighboring frames (opticalFlowHS object in Matlab).The paw position for both frames in this pair was taken according to the rst frame.The vertical component of the optical ow was extracted since this is the major movement axis during stimulation.Finally, the optical ow was only sampled at pixels with a saturation above 20% (0.2 for saturation of the rgb2hsv function in Matlab).This was done in order to sample paw movements rather than more unspeci c "fur" movements.Trials in which the rat was grooming, eating or walking was eliminated from further analysis.The amount of movement for each stimulation frequency was then calculated by averaging the energy in the 0.1, 0.3, 1, 3 and 10Hz band (using the spectrogram function in Matlab with window size of 100 and overlap 99).
In addition to the automatic behavioral quanti cation described in the previous paragraph, in gure 6D we manually quanti ed how the animal responded to the optogenetic stimulation.To this end we measured the duration for which the rat performed an abnormal behavior.Abnormal behavior was de ned as a paw movement for which the rat was lifting and lowering the right paw towards the original location at least two times.We excluded movements that could be ascribed to walking, grooming or movements that showed a coordination between left and right paw.Although the criterion seemed robust, there was one trial in which rat 512 stretched out the paw abnormally for the 10 Hz stimulation and this was therefore not counted as a cyclic movement.

Encoding and decoding
Encoding and decoding of the paw velocity was done by multiplying a temporal kernel with the paw velocity (for encoding) or with the neuronal activity (for decoding).The temporal kernel spanned from -2 seconds to 2 seconds with a temporal resolution of 10 ms.The weights of the temporal kernel was optimized with a least-squares method in order to follow the behavior (for decoding) or the neuronal activity (for encoding).
For encoding the paw velocity in the X and the Y direction was used to predict the neuronal activity for each sorted unit.Thus, for the encoding the kernel was a matrix with Tx2 weights (2x401 samples, see above).
We did two types of decoding.For testing the frequency dependency of decoding performance we used a single sample kernel with the weight at time 0 relative to the behavior, or a double sample kernel with the two weights at -1/frequency and 0. The frequency corresponded to the center frequency of the bandpass lter neuronal activity.Thus, for the frequency dependent decoding the kernel was a matrix with 1xU weights, or a matrix with 2xU weights, where U corresponds to the number of units.
For extracting the unit speci c decoding kernel we used one temporal kernel (401 samples, see above) for each paw velocity direction.The temporal kernel of one unit was optimized independently of the temporal kernel of another unit.Thus, for the unit speci c decoding kernel each kernel was a matrix with Tx1 weights, where T corresponds to the number of weights in the temporal kernel (i.e.401).The wavelet analysis of the decoding kernels was done using the Matlab command cwt with symmetry parameter 1.5 and time-bandwidth product 2.

Statistical procedures
All statistics and graphical illustrations of spiking unit data have been corrected for the possibility that the same unit has been recorded during multiple consecutive days (Supplementary Table 3).In cortex, evidence has been provided that tungsten electrodes are able to record the same unit for an average of three days, and a considerable amount (11%) of neurons could be recorded for up to seven days 45 .Since we had a recording session almost every day we conservatively regarded every 7 th unit to be an independent data sample.To this end, the degrees of freedom were calculated on the basis of the unit count divided by 7. We made this correction for the t-test, the Pearson correlation coe cient, and the ANOVA.For box plots (using Matlab's boxplot function), we plotted the bootstrapped data (using Matlab's bootstrap function with 1000 iterations) and adjusted the standard deviation of the bootstrapped data such that it was times that of the original data.In addition to this correction for independent data samples was also applied a mixed effect model.The modulation duration difference between cortical areas was also tested using a linear mixed effect model for which the areas were modelled with an additive random effect and the cortical location was modeled with a xed effect.All responses from a given electrode were averaged across sessions for a given animal.
For statistical testing, we assumed that the data was normally distributed.The test statistics for the Pearson correlation coe cient, the ANOVA and unpaired statistics approached a normal distribution for large data samples.For the paired t-test, we assumed a normal distribution as the test distribution was symmetric around 0. Unless otherwise stated, samples were described as mean and standard deviation of the mean.
Since we had one less animal in the joystick task (animal 220 lost the implant before it learned the joystick task), all paired tests were done without animal 220 in both the joystick and locomotor task.The non-paired tests were done using all 6 animals in the locomotor task and all 5 animals in the joystick task.

Declarations Figures
Studying neuronal dynamics with minimally repetitive behavior.A: Illustration of the difference between decorrelated and repetitive behavior in terms of the behavioral autocorrelation and neuronal cross correlation for the locomotor task.The behavioral autocorrelation is broader for a repetitive locomotion (bottom panels) than for a decorrelated behavior (top panels).The minimal value (dashed line) of the neuronal cross correlation is low if there are lags for which the two neurons do not spike (indicating correlated ring) and it is high if the two neurons re at different lags (indicating de-correlated ring) (illustration in left panel).Autocorrelation for the velocity of the right front paw during the locomotor task (gray data panel).B: Same outline as in A but for the joystick task.A repeating trial structure causes correlations between different trial periods.This in turn may increase the width of the behavioral autocorrelation as well as the correlation between neurons.C: Setup of locomotor task.D: Setup of joystick task.E: Electrode locations on the sensorimotor cortex for respective animal.F: Velocity modulation of the instantaneous ring rate for 2 example units with action potential waveforms (left inset) and interspike interval histogram (right insets) in the locomotor task.Neuronal ring rates modulated by future or past paw movement velocities are assigned to negative temporal lags (referring to planning) or to positive temporal lags (referring to sensory integration), respectively.Lags between 0 and 100ms are considered to be related to motor execution.The dark-blue unit has a broad velocity modulation, whereas the light-blue unit is temporally very precise.Both units originate from the same recording session.G: Same outline as in F but for two different units in the joystick task.The dark-red unit has a broad velocity modulation, while the light-red unit is temporally precise.H: The unit with the minimal (bright-blue) and maximal (dark-blue) duration of the velocity modulation for each locomotor session.The error bars denote the standard deviation of bootstrapped durations.I: Same outline as in H but for the joystick task.Light-red and dark-red corresponds to units with minimal and maximal modulation duration respectively.J: The summed velocity modulation for motor planning-related activity (negative lags from -1.1 to -0.1 s) minus the summed velocity modulation for sensory integration related activity (positive lags from 0 to 1 s).Signi cances are indicated according to: *** p < 0.001.
High-pass ltered neural activity is correlated to paw velocities.A: Schematic illustration of how a highfrequency neuronal activity can be superimposed on a low-frequency neuronal activity and yet be Figure 5 xOptimal frequency for decoding behavior.A: Higher neural frequencies predict paw velocities better than lower frequencies.Original paw velocity in the locomotor task (i).Decoded paw velocity using low (ii) and high (iii) neural frequencies.The gray curves depict movements in the lateral-medial (LM) direction, black curves refer to movements in the anterior-posterior direction (AP).B: Same as panel A, but for the joystick task.C, D: Decoding performance is dependent on the neural frequencies for the locomotor task (C) and for all animals.The average state coding was calculated for preferentially high frequency and low frequency coding.A negative or positive state coding value refers to a dominant null space or output potent space, respectively.The frequency coding is de ned by either a dominance of high or low frequencies of neuronal changes.Dominant high frequency changes are associated with the output potent space, whereas dominant low frequency changes were correlated with the null space.

Figure 2 The
Figure 2

Figure 3 The
Figure 3