To develop a methodology that can be used to measure the temporal latency of a respiratory gating system.The gating system was composed of an automatic gating interface (Response) and an in‐house respiratory motion monitoring system featuring an optically tracked surface marker. Two approaches were used to measure gating latencies. A modular approach involved measuring separately the latency of the gating system's complementary metal–oxide–semiconductor tracking camera, tracking software, and a gating latency of the LINAC. Additionally, an end‐to‐end approach was used to measure the total latency of the gating system. End‐to‐end latencies were measured using the displacement of a radiographic target moving at known velocities during the gating process.Summing together the latencies of each of the modular components investigated yielded a total beam‐on latency of 1.55 s and a total beam‐off latency of 0.49 s. End‐to‐end beam‐on and beam‐off latency was found to be 1.49 and 0.34 s, respectively. In each case, no statistically significant differences were found between the end‐to‐end latency of the gating system and the summation of the individually measured components.Two distinct approaches to quantify gating latencies were presented. Measuring the end‐to‐end latency of the gating system provided an independent means of validating the modular approach. It is expected that the beam‐on latencies reported in this work could be reduced by altering the control system configuration of the LINAC. The modular approach can be used to decouple the individual latencies of the gating system, but future improvements in the temporal resolution of the service graphing feature are needed to reduce the uncertainty of LINAC‐related gating latencies measured using this approach. Both approaches are generalizable and can be used together when designing a quality assurance program for a respiratory gating system. Several authors have presented methods for measuring gating latencies using the displacement of a radio‐opaque moving target captured using film or the LINACs electronic portal imaging device (EPID).This work presents two distinct approaches to measure the latency of a respiratory gating system. One of these approaches can be used to measure the latencies of the gating system's individual components, whereas the other can be used to measure the gating system's total end‐to‐end latency.2This work utilized a commercially available gating interface  to connect a respiratory motion monitoring system to a LINAC . The respiratory motion monitoring system was created at our institution and was designed to track the 1‐D vertical displacement of a reflective marker placed on the patient's abdominal surface. The marker was optically tracked using a complementary metal–oxide–semiconductor (CMOS) 2‐Megapixel camera with a USB 2.0 interface and CMOS OV2710 sensor . The camera was positioned on the treatment couch 80 cm from the marker. Both were aligned on the treatment couch using the room's wall‐mounted sagittal wall laser to provide a reproducible setup. A computer with an Intel Core i5 processor  was used to run the in‐house Windows‐based software that would track the centroid position of the reflective marker  was used to synchronize the motion of an optically tracked reflective marker and a radiographic target. This allowed gated images of the radiographic target to be captured when the marker entered the gate window. The radiographic target was a 3‐cm diameter plastic sphere embedded in a cylindrical cedar insert. The radiographic target was set to move only in the longitudinal direction with displacements ranging from ±1.5 cm. The reflective marker was secured to the chest wall platform of the phantom and was monitored using the gating system's CMOS camera Figure . The EPIThe reference position used for the gated images corresponded to one of the user‐configurable gating thresholds. The gating thresholds were chosen because they trigger the beam on or off during gated deliveries. Therefore, imaging the target at this position shows its location under the ideal conditions of no latency present in the system. To set the target at the reference position, the amplitude of the chest wall platform of the phantom was manually adjusted while monitoring the respiratory trace in the tracking software. Once the respiratory trace reached the lower amplitude gating threshold, the tracking software would alert the user, and this phantom position would be used to acquire the reference image. Therefore, the accuracy that the reflective marker could be set to the reference position was related to the pixel size used within the tracking software, which was on the order of 1 mm. An MV portal image was acquired of the static target at the reference position using 100‐MU and a 6‐MV beam energy.Gated images of the target traveling at constant velocity were acquired with the phantom and gating thresholds kept in the same positions that were used to collect the reference image. This ensured that displacement of the target from the reference position in each image would be the result of the end‐to‐end latencies present in the gating system. The phantom was programed with custom respiratory traces of ramp functions so that the radiographic target would be moving at constant velocity while the gated images were acquired. To measure beam‐on latency, the respiratory phantom was programed to move the target into the gate window. For beam‐off latency, the phantom was programed to begin inside of the gate window and while the beam was being delivered the target was driven out the gate window with constant velocity. The target velocities used in this study ranged from 1 mm per second to 48 mm per second. Images of the moving target were captured with the EPID and were averaged together to produce a single image of the target's travel while the beam was on.All image analysis was performed using open‐source image processing software .t‐test was used to test for significant differences between them.Average displacements were calculated from the set of repeat measurements collected at each target velocity. Target displacements due to beam‐on and beam‐off latencies were plotted separately against the known target velocities Figures  and 8. T3The measured latencies for each of the components investigated using the modular approach are listed in Table t(14) = 0.21, p = 0.83) between the modular and end‐to‐end approaches. Similarly, no significant difference in beam‐off latency was observed (t(31) = 0.56, p = 0.58) between the two approaches presented.The results of the end‐to‐end approach for beam‐on and beam‐off latencies are shown in Figures 4Negative offset values were observed for each of the linear fits shown in Figures Target displacements shown in Figure One of the limitations of the end‐to‐end approach was that target displacement was manually measured on each gated image, which is susceptible to inconsistencies in defining the edge of the target due to motion blurring at high target velocities. Multiple measurements were made at each target velocity to improve the accuracy of this method. An improvement to this technique could involve multiple people measuring the target displacement in each image or automated measurements to improve consistency. Additionally, utilizing a target with high radiographic contrast may improve the ability to delineate the edge of the target.Others in the literature have reported considerably smaller beam‐on latencies than those reported in this work using the modular or end‐to‐end approaches.One of the benefits of utilizing a modular approach when characterizing gating latency is that it allows the contribution of the system's individual components to be decoupled from the end‐to‐end total. For instance, we found that the latencies of this gating system were dominated by the beam‐on and beam‐off time delay of the LINAC. The streaming latency of the tracking camera also had a considerable impact, especially for beam‐off latency given its relatively small magnitude. This type of analysis can provide insight into which components of the gating system should be targeted when trying to reduce system latencies.The modular approach can be generalized to other gating systems that utilize different components than those studied in this work. Currently, there are several commercially available systems that employ optical tracking. The streaming latency of the cameras utilized in these other systems could be measured with the same technique used in this work. For gating systems that employ other forms of respiratory motion monitoring the user could either measure their latency directly, or, use published data for their specific system. The LINAC gating latency of the users system could be measured using the graphing feature of the LINAC control system. This novel method provides a convenient way to investigate the impact that changes to the control system configuration of the LINAC has on gating latency. However, one of the limitations of this method is that the 4‐Hz sampling frequency of the service graphing feature limits the precision at which LINAC gating latencies can be measured.The end‐to‐end approach can also be generalized to other gating systems as long as the motion of a respiratory phantom can be coupled to the gating system's respiratory motion monitoring system. This approach was able to measure system latencies with less uncertainty than the modular approach and could be used as a method of independent validation. Disagreement between the results of the two approaches could demonstrate that not all of the gating system's components were included in the modular analysis.Routine quality assurance (QA) for respiratory gating systems is recommended by the report of Task Group 142 of the American Association of Physicists in Medicine.5In this work, two distinct approaches to quantify gating latencies were presented. End‐to‐end measurements provided an independent means of validating the total system latencies found using the modular approach. The modular approach can be used to decouple the individual latencies of the gating system, but future improvements in the temporal resolution of the service graphing feature are needed to reduce the uncertainty associated with latencies measured using this approach. Both approaches can be generalized to other respiratory gating systems and can be used together when designing a QA program.The authors have no conflicts of interest to disclose.Michael G. Stock collected the data and drafted the manuscript. Connel Chu was responsible for creating the gating system studied in this particular work and providing insight on possible ways to measure gating latencies of this novel system. Jonas D. Fontenot was responsible for providing expertise on the direction and scope of the project, reviewing the data, and editing and reviewing the manuscript.


The aim of the present study was to offer a first investigation of the neuro-cognitive processes and the temporal dynamics at the neural level, together with cultural, social and psychological dimensions, that may support resistance to orders to harm another person. Using a novel experimental approach to study experimentally disobedience, we recruited individuals from the first generation born after the 1994 genocide in Rwanda. Seventy-two were recruited and tested in Rwanda and 72 were recruited and tested in Belgium. Results indicated that a higher neural response to the pain of others and a higher feeling of responsibility when people obeyed orders were associated with more resistance to immoral orders. We also observed that participants who had a higher processing, as measured through mid-frontal theta activity, when listening to the orders of the experimenter disobeyed less frequently to immoral orders. Further, participants experiencing a higher conflict before administering a shock to the ‘victim’ also disobeyed more frequently to immoral orders. Finally, a low cultural relationship to authority and a high estimated family suffering during the genocide were also associated with more disobedience to immoral orders. The present study opens new paths for interdisciplinary field research dedicated to the study of obedience. Such examples have not only been observed in military personnel mandated during wars. Civilians are also capable of atrocious acts to follow authoritative figures2. As an example, the Genocide Against Tutsis has been characterized by a high number of civilians who joined the Interahamwe militia, the Hutu militia told to be responsible for the 1994 genocide. There are fortunately several examples in history that showed that some individuals risked their own life by resisting orders to save other human beings3. However, why some individuals resist immoral orders while others obey such orders remains largely unknown.The history of nations is plagued by horrendous acts of obedience that have caused wars and the loss of countless lives4 and its subsequent variants6, the second axis has been much less investigated. A few studies showed that some personality traits may support disobedience 8. But studying personality traits supporting disobedience is not sufficient to understand why, in a given situation, some people will refuse orders to harm another person while others will comply with such orders. In the present study, our aim was to offer a first investigation of the neuro-cognitive processes and the temporal dynamics at play when people choose to obey or disobey immoral orders, together with cultural, social and psychological dimensions, which may support resistance to immoral orders. There is a substantial debate around the definition of morality9. In the present research, immoral orders refer to orders to inflict physical pain to another person.Understanding why some people refuse immoral orders while others do not involves answering two main axes of research: (1) which social and situational factors support resistance to immoral orders, and (2) which individual traits and neuro-cognitive differences support resistance to immoral orders. While the first axis has been significantly covered by past experimental research, notably Milgram’s studiesWhen someone obeys or disobeys an order, several cognitive processes are involved at different moments. First, one hears and processes the auditory instruction received from the person giving orders. Then, one decides to obey or not this order, and then executes the corresponding action. Finally, one processes the consequences of their action on others. Translated into neuro-cognitive terms, an investigation of the temporal dynamic of (dis)obedience would involve five key processes, that are: (1) the neural processing of the auditory information when individuals receive the order, (2) the degree of cognitive conflict before acting, (3) the sense of agency over the action and its consequence, (4) the feeling of responsibility over the decision, and (5) empathy for what the victim may feel. The present study aims to investigate the involvement of each of these neuro-cognitive processes to understand how they relate to prosocial disobedience. To do so, behavioural and electrophysiological measurements will be used. Electroencephalography (EEG) allows to study the temporal course of cognition considering its acute temporal resolution.10 and reduced vigilance to auditory stimuli11. In the present study, we investigated to what extent the processing of the auditory instructions to physically harm another individual or not influenced the extent to which participants disobeyed orders. To the best of our knowledge, no previous studies investigated to what extent the processing of auditory information influences subsequent obedience behaviors. However, past theoretical work suggested to the more people would distance themselves from the experimenter, the less they would comply with orders12. We thus expected that individuals who distance themselves from the orders of the experimenter and disengage their attention from the orders received, as reflected by a lower FMθ, would disobey more frequently.In the literature, past studies showed that a reduced activity in the frontal midline theta rhythm  was associated with reduced conscious attention of the auditory processing13. Previous studies indicated that a higher cognitive conflict involves that the selected action was not the most natural to select compared to the other actions, which can lead to a change in behaviors14. Using EEG, past literature has shown that a stronger conflict elicits a higher activity in the FMθ compared to low conflicts19. Here, we expected that those having a high FMθ, indicating a high cognitive conflict, before obeying the orders to harm another person would refuse more frequently those orders.Cognitive conflict occurs when two competing response options compete for control of behavior20. In the literature, the sense of agency has been measured with explicit methods, but those methods can be biased by social desirability21. An alternative, implicit measure of the sense of agency based on time estimation of action-outcome intervals has thus been used22. In classic time estimation tasks, participants have to estimate the duration of a time interval that elapsed between an action  and its consequences . Results typically show that participants tend to estimate time intervals as shorter when the action is performed voluntarily compared to a condition in which the action is performed involuntarily23, an effect referred to as temporal binding. The feeling of responsibility is related, but refers to a mental representation of authorship in a social context24. It has been mostly measured with explicit questions asked to the participants26. Previous work showed that when individuals obey orders, their sense of agency and their feeling of responsibility are attenuated compared to a situation where they are free to decide which action to execute29. Another study indicated that temporoparietal junction (TPJ) subserves the sense of agency30. The authors showed that cathodal stimulation over the right temporoparietal junction (rTPJ) reduced reaction times to harm another person in a situation of obedience. Finally, another recent study showed that a reduced sense of agency, as measured with the method of interval estimates, and a low feeling of responsibility correlated with a high number of shocks sent to a victim31. We thus predicted that a higher sense of agency and a higher feeling of responsibility, would be correlated with a higher prosocial disobedience.The sense of agency has been mainly described as the feeling that we are the authors of, and thus potentially responsible for, our own actions and their consequences in the external world32. Empathy can be measured through several measurements, from subjective reports to indirect neuroimaging measurements. An extensive literature using neuroimaging has shown that seeing another individual in pain triggers an empathic response in the brain of the observer, especially in the insula and in the anterior cingulate cortex. In EEG studies, a recent meta-analysis suggested that the P3 and the Late Positive Potential (LPP) are robust to measure the neural response to the pain of others33. Previous research showed that a higher neural response to the pain of others is linked to a higher prosociality35. Refusing to obey an immoral order is also a prosocial behaviour and could thus rely on similar mechanisms. We thus expected a higher amplitude of the P3 and the LPP to be associated with a higher prosocial disobedience.Empathy for pain has been defined as our capacity to feel others' pain, including the pain that we can cause them36 or its subsequent variants, which demonstrated a strong willingness to follow the orders of an experimenter. However, Milgram’s studies posed serious ethical issues, such as the use of deception, the high stress caused to the participants and the fact that participants were in the role of the perpetrator only37. Further, the subsequent variants of Milgram’s studies6 were not adapted for neuro-cognitive measurements. Recently, a novel experimental paradigm has been developed to study disobedience38. In this paradigm, two volunteers are recruited and take turns to be ‘agents’ or ‘victims’, making the procedure fully reciprocal and avoiding having people in the role of the perpetrator only. For each trial, the agents receive an order from the experimenter to send a real, mildly painful electric shock to the ‘victim’, thus placing participants in an ecological set-up and avoiding the use of cover stories and deception. These shocks lead to either a small monetary gain or no monetary gain at all. In this paradigm, disobedience to immoral orders  corresponds to the number of times agents refused the orders of the experimenter to send a painful shock to the ‘victim’. Several variants have been tested on university students in Belgium and results indicated that the prosocial disobedience rate ranged between 7.03 and 60.88%, thus indicating that it can be used to study disobedience. Importantly, stress is very minimal with this novel experimental approach38. As this paradigm is adapted to neuro-cognitive measurements, we used it in the present study. We tested three variants of the same task to create variability in prosocial disobedience to subsequently perform correlations. In previous work38, receiving money for each shock was a main factor modulating prosocial disobedience by about 20%. In one variant of the present task, participants thus received money for each shock sent, and in another variant, they did not receive a monetary reward. In a third variant, we explicitly told participants that they were free to decide to send shocks or not in exchange for money despite the orders of the experimenter.Past scientific literature on (dis)obedience is most exclusively based on Milgram’s study39. In Rwanda, the new generation has grown up in a context in which obedience to authority is a huge concern. Genocides are indeed frequently referred to as ‘crimes of obedience’40, with a majority of perpetrators complying with orders to exterminate another group as the commonality. In Rwanda, the ‘following bad leaders’ statement is a popular explanation for the genocide41, emphasizing specific concern regarding the consequences of blind obedience.Critically, the classical WEIRD  population used in neuroscience is not frequently facing extreme situations of obedience and their dramatic consequences. In the present study, we thus decided to test our predictions on the new generation of Rwandese born after the genocide instead of more classical western university students because growing up amidst or in the aftermath of wars has strong effects on individuals44. This phenomenon, referred to as acculturation43, has also been shown to occur in migrants’ children45. In the present study, to enlarge our understanding of the cultural and psychological factors influencing prosocial disobedience, we thus compared two groups of participants: a group composed of Rwandese born after the genocide and currently living in Rwanda and a group composed of Rwandese born after the genocide and living in Belgium. However, to the best of our knowledge no previous studies compared the same constructs on these two groups of individuals. Our comparisons between the two groups on the relationship to money, relationship to authority, on moral foundations and to the identification to the experimenter were thus exploratory and not hypothesis driven.We decided to explore if Rwandese leaving in Rwanda or Rwandese leaving in a different country would have similar results regarding prosocial disobedience and the related processes. Migrating to another country lead to cultural and psychological changes resulting from the direct contact with people from another culture3, we also integrated several additional predictor variables for prosocial disobedience. Deference to authority has been emphasized as a factor of importance to explain the genocide in Rwanda48 and was thus added as a predictor variable with the aggression-submission-conventionalism scale49. Humans are sensitive to different competing issues of morality, which has been identified as a key reason for rescuing persecuted people50. We thus also integrated the moral foundation questionnaire51. Since participants could receive a small monetary reward for each shock, we also evaluated their attitude to money with the money attitude scale52. It had also been argued that identification with the authority promotes obedience53. We thus also integrated a questionnaire on the identification with the experimenter12.As people’s decision to comply with immoral orders can be influenced by several cultural, social and psychological factors54, thus implying an increased prosociality. However, previous research largely ignored individual-level behaviors, especially in the context of obedience to authority, focusing mostly on the population level. Further, no previous studies sought to understand the psychological and neural mechanisms influencing individual behaviors in this context. In the present study, we thus also examined to what extent our participants estimated that their family suffered during the genocide, and to what extent they participate in reconciliation activities relates to prosocial disobedience.Past work suggested that historical victimization encourages a sense of moral obligation to reduce the suffering of others55. We decided to increase this number up to 144 (= 72 pairs) in order to prevent potential loss of data. The discrepancy between the number of male and female participants in the group tested in Rwanda was due to the current female hairstyle in Rwanda , which is not compatible with electroencephalography (EEG) recordings. We recruited participants studying at university to facilitate comprehension since the official language in universities in Rwanda is English, but also to control for the educational level, as participants tested in Belgium were also university students. In both countries, participants had to have at least one parent from Rwanda. We selected participants between 18 and 26 years old in order to have a sample composed of individuals who were not born yet when the genocide happened in 1994. The mean age was 23.36 (SD = 1.60) for the group of Rwandese tested in Rwanda and 22.11 (SD = 2.65) for the group of Rwandese tested in Belgium. The following exclusion criteria were determined prior to further analysis: (1) failure to understand the task, (2) failure to perform the interval estimate task used as a proxy for sense of agency correctly, or (3) failure to obtain good signal-to-noise ratio for EEG recordings. Classic reasons to fail to obtain a good signal-to-noise ratio involve eye movement or head movement artefacts, or no clear Event-Related Potentials (ERPs). For the group tested in Rwanda, we had to increase those reasons to the following: 50 Hz noise  because there was no ground plug in the room we were given to conduct the experiment; heavy rain or numerous crows on the sheet metal roof that did not allow the participants to hear auditory stimuli; power cuts during the testing; or sweat artefacts due to hot temperatures. For the group tested in Belgium, the full data of one participant were not acquired due to a late arrival and the lack of time to finish the role reversal procedure. In the group tested in Rwanda, we lost the EEG data of 3 participants, 1 because of the high number of eye blinks, 1 because of noisy crows on the metal sheet roof and 1 because of the noise of the rain. In the group tested in Belgium, we lost the EEG data of 4 participants, 1 participant because of visual artefacts, 1 because of sweat artefacts and 2 because of a problem with CMS/DRL electrodes. Of note, for some participants we could only record central electrodes  because their (braided) haircut did not allow to obtain a reliable signal on other electrodes. Other data were not removed for those participants. To identify participants for whom the action-tone intervals did not gradually increase with action-tone intervals, we performed a linear trend analysis with contrast coefficients − 1, 0, 1 for the three delays we used, similarly to previous studies27. The data of 40/72 participants in the group tested in Rwanda were excluded due to a non-significant linear trend analysis. For the group tested in Belgium, the data of 38/72 participants were lost due to a non-significant linear trend analysis. Of note, this amount of non-reliable data for this task was not predicted and is thus further discussed in the general discussion. Again, other data were not removed for those participants in order to keep a reliable sample size for all the other measurements. The study and its prior hypotheses were approved by the National Ethics Committee of Rwanda (permission 710/RNEC/2019) for the group tested in Rwanda and by the local ethical committee of the Université libre de Bruxelles and the Ethics Committee Erasme Hospital (permission 053/2019) for the group tested in Belgium. For this study all methods were carried out in accordance with relevant guidelines and regulations. Informed consent was obtained from all participants with a method approved by the two ethics committees, ensuring that any potential cultural differences for giving a consent would be considered.One hundred forty-four Rwandese were recruited for this experiment. Seventy-two were recruited and tested in Rwanda  and 72  were recruited and tested in Belgium. A priori computation of sample size indicates that we needed to recruit 134 participants (= 67 pairs) to detect a correlation (two-tailed) of 0.30 with 95% power (Cohen’s convention)Participants were invited by same-gender pairs to participate in this study. We ensured that they were not close friends or relatives. Upon arrival in the laboratory, participants were invited to sit, and they were explained the task in detail, both in English and Kinyarwanda for the group tested in Rwanda and in French for the group tested in Belgium. Both participants filled in the written consent in front of each other and were reminded that they could stop the study at any time.I will give you instructions to give a shock or not to the victim and you will have a keyboard with two buttons, one labelled ‘shock’ and one labelled ‘no shock’. You will have to press one of the two buttons after receiving my instructions”. There were 3 variants of the same task . In the ‘Do not decide + monetary gain’ variant, if they pressed the SHOCK button, they delivered a painful electric shock to the ‘victim’ in exchange for 50RWF (in Rwanda) or €0.05 (in Belgium). If they pressed the NO SHOCK button, they did not deliver the painful shock to the ‘victim’ and they did not earn additional money. In the ‘Do not decide + no monetary gain’, the financial reward was removed for each shock delivered. In the ‘Decide + monetary gain’ variant, participants earned the financial reward for each shock, but they were explicitly told that, as adults, they remained free to decide to send or not the shock to the ‘victim’. Importantly to mention, at no moment participants were explicitly incentivized to obey orders. We neither explicitly mentioned that they had to follow the orders of the experimenter, nor that we needed them to obey for the sake of the experiment. We also did not react when they pressed the ‘wrong’ button . In addition to the consent forms, we also asked them to fill a document that explicitly stated that they understood that they would receive the remuneration for their time for this experiment, no matter their decisions during the task, see Supplementary Material S1. This procedure was decided to ensure that participants understood that they would be paid even if they refused to follow the instructions of the experimenter. Thus, participants were never explicitly incentivized to disobey orders, but they were not incentivized to follow orders neither, such as in Milgram’s studies6 in which participants were explicitly solicited to follow orders. We could thus evaluate their spontaneous propensity to disobey orders. In the variant where they could decide, participants also had to fill in a document that explicitly stated that they understand they could disobey orders .Participants were explained that there were two roles in this experiment, one of ‘agent’ and one of ‘victim’. They were randomly assigned to start in one of the two roles, but their roles were switched at the middle of the experiment. Thus, some participants first performed the task as agent and then became victim, while other participants had the opposite role reversal procedure. They were told that agents would receive instructions from the main experimenter to either give a painful shock or not to the ‘victim’. They were then told that they will have two buttons: a SHOCK button and a NO SHOCK button. Participants were told the exact following wording: “By picking randomly a card in a box, participants were assigned to start either as agent or victim but were offered the possibility to change if they wanted to. The participant who was in the role of the agent was brought in an isolated room and the ‘victim’ was bought in another room see Fig. .Figure 127. Participants were told that this selected threshold would neither increase nor decrease during the experiment. The ‘victim’ was asked to place her hand on the table in front of a camera and not to move it during the session. The victim was invited to watch a neutral documentary to make the time pass.Two electrodes were placed on the victim’ left hand on the abductor pollicis muscle in order to produce a clear and visible muscle twitch and the threshold was increased by steps of 1 mA until a painful stimulation was achieved following the procedure described in4. Agents were given headphones and were told that they would be able to hear the instructions of the experimenter who would be giving orders through a microphone connected to the headphones from another room. Second, since we were recording Event-Related Potentials (ERPs) associated with the visualization of pain on the victim’s hand , having a real-time display of the victim’s hand on an adjusted and fixed screen would better prevent head and eye movements.The agent was told that they would be isolated from both the victim and the experimenter in order to avoid visual distractions during EEG recordings. In reality two reasons explained the decision to isolate the agent. First, a previous study reported that when the experimenter is not present in the room, disobedience to immoral orders increasesgive a shock’ or ‘don’t give a shock’. In reality, these sentences were pre-recorded. To increase the authenticity of the procedure, each sentence was recorded 6 times with small variations in the voice and displayed randomly. In addition, the audio recordings included a background sound similar to interphone communications. After receiving the verbal order, a picture of two rectangles, a red one labelled ‘SHOCK’ and a green one labelled ‘NO SHOCK’, was displayed on the left and right bottom of the screen. The key-outcome mapping varied randomly on a trial-wise basis, but the outcome was always fully congruent with the mapping seen by the participant. Agents could then press one of the two buttons. A beep followed each keypress by 200, 500 or 800 ms, according to the method action-outcome interval estimates used as a proxy for the sense of agency. If the SHOCK button was pressed, agents witnessed a muscular twitch on the victim’s hand displayed at the same time as the tone. An analogue scale with ‘0’ on the left side of the scale and ‘1000’ on the right side was then displayed on the screen and participants were asked to estimate the duration of the action-tone interval in ms. A red position marker was displayed on that scale with a number, corresponding to the marker’s current position in ms. The starting position of the marker varied randomly on a trial-wise basis and participants were told to ignore the starting position of that scale when providing their final answer. By using the same two buttons as for shock and no shock, participants could move the position of the cursor on that scale to the left or to the right. By pressing for a long time, the cursor moved by steps of ± 50 and by pressing for a short time, the cursor moved by steps of ± 1. After a fixed duration of 6 s, their answer was saved, and the next trial started. Each participant started with a training session to practice the time interval procedure. The training session lasted for a minimum of 8 trials and was repeated until participants declared that they could perform the task correctly. There was a total of 96 trials, 64 in which the experimenter asked to give a shock and 32 in which the experimenter asked not to give a shock, as in38.Each trial started with a fixation cross lasting between 1 and 2 s. When the fixation cross disappeared, the experimenter told the agent either ‘not painful at all’ (0) to ‘very painful’ (1000), again with a cursor starting at a random position on that scale.To be able to measure the neural response to the pain of others, volunteers were told to always look at the hand of the victim during the experiment and to move as little as possible. To ensure that participants were actually looking at the real-time video showing the victim’s hand, on some trials, they were asked to rate how painful the shock delivered to the victim was. Another analogue scale then appeared on the screen, ranging from ‘64 indicated that it is important that participants recruited in Rwanda do not think that the experimenter is affiliated with the Rwandan government. For this reason, we did not use a Rwandan experimenter to give orders to the participants tested in Rwanda.For both groups the experimenter was a Caucasian-type, female experimenter. A former studyIf some volunteers would have decided to act in a fully prosocial fashion by systematically refusing to administer shocks to the victim, this would have led to no EEG data associated with the visualization of the electric shock sent to the victim’s hand. Therefore, the session ended with an additional observation block, during which volunteers visualized 14 trials with a shock sent to the victim’s hand and 14 trials with no shock. A tone was again systematically played. Volunteers were told to always look at the hand of the victim during that block and that the computer will send or not send the shock. To obtain a similar predictability of outcomes between the observation block and the main experimental block, a square labelled either SHOCK or NO SHOCK was displayed on the screen at the beginning of the trial. Volunteers were told that they would still have to complete the pain scale, similarly to the main experimental block.52, (2) the Moral Foundation Questionnaire51, (3) the Aggression-Submission-Conventionalism scale49, (4) a debriefing assessing what they felt during the experiment and the reasons for choosing to obey or disobey the orders of the experimenter , (5) a questionnaire assessing the family trauma during the genocide and the participation to reconciliation programs (only for the group tested in Rwanda)  and (6) a questionnaire on social identification to the experimenter12, see Supplementary Material S4 for the questionnaire in English and Kinyarwanda). We could not ask participants in Rwanda for their ethnic group and to what extent they considered their co-participant as part of their own group or not because it is illegal to mention ethnicity or differences between ‘groups’ of individuals in Rwanda.At the end of the experimental session, participants were asked to fill in six questionnaires presented in both English and Kinyarwanda for the group tested in Rwanda and in French for the group tested in Belgium. For the translation in Kinyarwanda, a back translation procedure was used. A bilingual research assistant first translated each item in Kinyarwanda. Then, a professor (second author of this paper) translated back to English each item. They then discussed the potential discrepancies and ensured that they agreed on the translation of specific words that can be culturally different in the two languages. Those questionnaires included (1) the Money Attitude Scale56. The activities from left and right mastoids and from horizontal and vertical eye movements were also recorded. Amplified voltages were sampled at 2048 Hz. Data were referenced to the average signal of the mastoids and filtered (low-pass at 40 Hz and high-pass at 0.01 Hz). To clean the data from the line noise we then used a spectral interpolation around 50 Hz and its harmonics. Artefacts due to eye movements were removed with an Independent Component Analysis (ICA). A final cleaning based on visual inspection was then performed. 3.9% of the trials were removed. Because of the EEG recordings, participants were further instructed to wait a minimum of 1 s in a relaxed position before pressing a key, so as to obtain a consistent and noise-free baseline taken − 500 to − 300 ms before the occurrence of the tone. Participants were additionally instructed not to move for up to 2 s after the tone and asked to avoid blinking when they pressed a key. To ensure that participants respected the 2 s without moving and blinking after the tone, we told them to wait for the time estimation scale to appear on the screen as a cue.Brain activity was recorded using a 32-channel electrode cap with the ActiveTwo system (BioSemi) and data were analyzed using Fieldtrip software58. The time windows of the ERP components were chosen according to visual inspection of the grand-averaged data similar to past studies60 as well as prior knowledge. The N1 and the N2 were measured as the most negative peaks within the 30–130 ms time window and the 240–340 ms time window, respectively, after the tone. The P2 and the P3 were measured as the most positive peak within the 130–230 ms time window and the 340–440 ms time window, respectively, after the tone. The early LPP and the late LPP were measured as the mean amplitude between the 440–650 ms time window and the 650–900 ms time window, respectively, after the tone.All event-related potentials in the time-domain were analyzed across Fz, Cz and Pz, similar to past studies10(power/baseline)]. The baseline power was computed as the average power across all experimental conditions, from 300 to 500 ms after the keypress when TFR were response-locked and from − 200 ms to 0 ms when TFR were stimulus-locked.Based on previous studies, we measured the frontal midline theta frequency (FMθ) over the Fz, Cz, FC1 and FC2 electrodes. We extracted the time–frequency power of each trial after calculating a Fast Fourrier transform (FFT) on our data and an FFT of a complex Morlet wave with the following parameters: frequency from 2 to 30 Hz with 80 bins spaced logarithmically and 4–14 cycles logarithmically spaced. Then, we used the Inversed Fast Fourrier Transform (IFFT) method on the multiplication of the computed FFT on our data and the FFT of the complex Morlet Wave. Epoching was performed by taking − 3 to 1s around the keypress (response-locked time window) and − 1 to 3 s around the presentation of the auditory instruction (stimulus-locked time window). All power values in the time–frequency representation were normalized to the average pre-stimulus baseline power at each frequency band. We used a decibel (dB) transform for normalization [dB power = 10 × log1 or H061. Supplementary Material S5 provides more information on Bayesian statistics and how they were computed in the present study. Data deviating from more than 2 standard deviations were excluded.Results were analyzed with both frequentist and Bayesian statistics in order to provide complementary evidence in favor of H = 45.963, p < .001, η2partial = .250, BFincl = 1.452e +7), with higher prosocial disobedience rates in the group tested in Belgium  compared to the group tested in Rwanda , see Fig. 0 . We replicated the same univariate ANOVA with Gender as an additional fixed factor. The main effect of Gender was in favor of H0  and the pattern of results remained unchanged. We also conducted additional control analysis that showed that order of the role  did not influence the results . Of note, 9/72 participants in the group tested in Rwanda and 4/72 participants in the group tested in Belgium disobeyed in an antisocial way, that is, they administered a shock to the ‘victim’ even if the experimenter asked not to do so.We calculated the percentage of prosocial disobedience for each participant, corresponding to the number of trials participants chose to disobey  by the total number of trials corresponding to the order to send a shock, multiplied by 100. We compared the prosocial disobedience rate across groups and variants of the task. We conducted a univariate ANOVA with prosocial disobedience as the dependent variable and Group  and Variant of the Study  as fixed factors. Both frequentist and Bayesian approaches indicated a main effect of Group (F57), see Fig. vs when they did not witness a shock, in order to identify ERPs sensitive to the visualization of pain. Results indicated a higher amplitude for Shock trials vs No shock trials for the P3, the eLPP and the lLPP. No evidence was found for this difference on the N1, P2 and N2 .We compared the neural processing of pain when participants witnessed a shock being delivered on the hand of the ‘victim’. Based on both previous literature and the visual inspection of the grand averaged waves, we extracted the amplitude of several event-related potentials (ERPs) associated with either auditory outcome processing N1, P2) or with pain outcome processing . As a reminder, behavioral results indicated that the group tested in Belgium refused to administer a shock to the ‘victim’ more frequently compared to the group tested in Rwanda. Consequently, it could have led to a reduced amplitude of pain-related potentials due to a higher repetition suppression (RS). We thus performed similar analyses on the observation block, i.e., an additional block that was run at the end of the experiment for each participant . Since the frequency of shock and no shock trials was controlled in the observation block, RS was controlled. Results in the observation block were similar to the main experimental block with overall no conclusive difference between the two groups . Only the amplitude of the P3 was higher in the sample tested in Belgium than in the group tested in Rwanda (t(135) =  − 2.657, p = .009, Cohen’s d =  − .454, BF10 = 4.371). Additional control analysis showed that order of the role  did not influence the results for all ERPs .We then subtracted the amplitude of those potentials during No shock trials to Shock trials  and performed statistical comparison between the two groups on this new variable. We did not observe conclusive evidence for a difference in the neural processing of pain between the group tested in Rwanda and the group tested in Belgium  = 4.072, p < .001, Beta = .446, BFincl = 109.749), with a higher neural response to the pain of the ‘victim’ being associated with a higher percentage of prosocial disobedience, see Fig. p = .001, BF10 = 20.267), indicating that those with a higher neural response to the pain of the victim also estimated the pain of the victim as higher. We also ensured that the neural processing of pain was not stimulus-dependent, i.e., relative to individual differences between victims . Other ERPs  were inconclusive . All VIFs were below 2.5.Since overall results were similar between the main experimental block and the observation block but only the observation block allowed to include participants who disobeyed the most, subsequent analyses were conducted on ERPs in the observation block. We computed a general pain response by averaging the amplitude of the P3, eLPP and lLPP and used that pain response as the predictor variable into the model, together with the N1, P2 and N2. Results indicated that only the neural processing of pain was a reliable predictor of prosocial disobedience . Independent sample t-tests conducted on z-scored interval estimates when participants obeyed to send a shock to the ‘victim’ did not differ between groups . A similar comparison on trials where participants obeyed not to send a shock to the ‘victim’ was inconclusive . Comparisons in z-scored interval estimates between obedience and disobedience trials were unreliable, since they included only N = 9/72 in the group tested in Rwanda and N = 23/72 in the group tested in Belgium. This small sample was the results of the low rate of disobedience in the group tested in Rwanda combined with the failure to realize the task of interval estimates correctly. We further observed that the two groups did not differ in how responsible they felt for the outcomes of their actions during the experiment .As a reminder, the sense of agency was measured through a proxy based on interval estimates. Because interval estimates were planned to be correlated with prosocial disobedience, we first transformed the raw interval estimates in z-score data. It is indeed known that participants may differ in the way they use the ms-scale to provide an answer, some preferring smaller numbers and others preferring larger numbers(63) = 3.397, p = .001, Beta = .395, BFincl = 35.511). We observed that a higher reported feeling of responsibility during the task was associated with a higher prosocial disobedience, see Fig. 0 . All VIFs were below 2. Of note, a similar result was obtained for how responsible participants felt during the task when the whole sample was considered – and not only those who successfully performed the interval estimates task (t(143) = 3.384, p < .001, Beta = .273, BFincl = 29.84).We then conducted a multiple linear regression with the feeling of responsibility, z-scored interval estimates for shock trials when participants obeyed, and z-scored interval estimates for no shock trials when participants obeyed as the independent variables and prosocial disobedience as the dependent variable. Results indicated that how responsible participants felt during the task was the best predictor of prosocial disobedience  = 29.249, p < .001, η2partial = .191, BFincl = 16308.42). Results indicated that FMθ was higher for the group of Rwandese tested in Rwanda when they received instructions  than for the group of Rwandese tested in Belgium . We also observed a main effect of Instruction with the frequentist approach  = 6.441, p = .012, η2partial = .049), with more FMθ after hearing the instruction not to send a shock than after hearing the instruction to send a shock. However, the same result was inconclusive with the Bayesian approach (BFincl = 1.271). Other interactions were inconclusive or in favor of H0 . Additional control analysis showed that order of the role  did not influence the results . Pearson correlations indicated that the lower the FMθ after hearing the order to send a shock to the victim was, the higher the prosocial disobedience rate was , see Fig. Based on visual inspection of the grand average data see Fig. A, FMθ wapFDR = .006; BF10 = 6.566), a higher score to the authority subscale  and a higher score to bonding with the experimenter . None of the correlations were significant with the instructions not to send a shock .As we hypothesized that distancing oneself from the authority would involve a lower attention to the orders given by that authority, we conducted exploratory analyses to correlate the FMθ and the different self-reported questionnaires evaluating one’s own relationship to authority . Results indicated that a higher FMθ when hearing the order to send a shock was associated with higher scores to the submission subscale  = 11.260, p = .001, η2partial = .084, BFincl = 10.732), with more FMθ in the group tested in Belgium  compared to the group tested in Rwanda . Additional control analysis showed that order of the role  did not influence the results . Pearson correlations indicated that the higher the FMθ was before obeying the order to send a shock to the victim, the higher the prosocial disobedience rate was , see Fig. Based on visual inspection of the grand average data see Fig. B, FMθ wapFDR = .012; BF10 = 3.119). Other correlations with FMθ before not sending a shock were not statistically associated with the different subscales .As each shock in Variants 1 and 2 was associated with a monetary reward, we conducted exploratory analysis between the FMθ before sending or not a shock to the ‘victim’ and the different subscales of the MAS questionnaire measuring one’s attitude to money. Results indicated that a higher score on the retention subscale of the MAS was associated with a lower FMθ before sending a shock to the victim  approach with the Benjamini and Hochberg method to each p-value. As only 10/72 participants disobeyed in a prosocial way in the group tested in Rwanda, we did not have sufficient power to perform such analyses on each group separately. The results were thus performed on the two groups of participants together. Table Additional analyses were conducted on the reasons that participants gave to explain why they disobeyed or obeyed the orders of the experimenter and how it related to prosocial disobedience. The full results and individual statements are presented in Supplementary Material S11. Overall, results indicated that the percentage of prosocial disobedience positively correlated with moral reasons. Results also indicated that the more agents felt bad for the ‘victim’, the higher the prosocial disobedience was. We further observed that the less participants were interested in making money, the more they refused immoral orders. Exploratory analyses on antisocial disobedience are reported in Supplementary Material S12.63. The Genocide Against Tutsis represents the culmination point of such collective victimhood in Rwanda47. A key societal question is to understand what influences the decision of the new generations in war-torn societies to persevere in destructive behaviours. In the present study, we examined the specific situation of obedience to orders to inflict harm to another individual.In the region of the Great Lakes in Africa, collective victimhood and a desire for revenge have been considered as key elements explaining the ongoing conflicts11. This could indicate that disobedience is facilitated when individuals disengage their attention from the orders received by the authority. This disengagement could be facilitated by a low relationship to authority, as we observed that people scoring low to the different questionnaires assessing their relationship to authority also had a lower FMθ. As individuals in the group tested in Rwanda scored systematically higher regarding their relationship to authority compared to the group tested in Belgium, this may explain why FMθ was higher in the group tested in Rwanda, as well as obedience. This result also highlights that culture has an important weight when explaining people’s compliant behaviors. Interestingly, we observed a higher FMθ after hearing the auditory instruction in the group tested in Rwanda compared to the group tested in Belgium. As the group tested in Rwanda also had a lower prosocial disobedience rate compared to the group tested in Belgium, this would further support that disengaging from the orders of the authority facilitates disobedience.We targeted several neuro-cognitive processes in order to investigate the temporal dynamics of disobedience to immoral orders. Results indicated that the more participants processed the auditory instruction to send a shock to the ‘victim’, as indexed by a higher FMθ, the lower prosocial disobedience was. Previous studies suggested that a high FMθ during the processing of auditory stimuli is associated with a greater allocation of attentional resources19, it may thus suggest that obeying the orders to send a shock to the victim was perceived as an action inducing a stronger conflict in the group tested in Belgium compared to the group tested in Rwanda. Critically, this result could also explain why prosocial disobedience was higher in the group tested in Belgium compared to the group tested in Rwanda. We indeed also observed that a higher FMθ before obeying to send a shock to the ‘victim’ was associated with a higher prosocial disobedience rate. Interestingly, exploratory analyses showed that scoring high to the retention subscale of the money attitude scale was associated with a lower FMθ before sending a shock. This result may indicate the aversion to hurt others may be attenuated with the obtention of a financial reward for the pain inflicted, especially if the importance given to money is high.We observed a higher FMθ before obeying to send a shock to the ‘victim’ in the group tested in Belgium compared to the group tested in Rwanda. According to past literature, which showed that a stronger conflict elicits a higher activity in FMθ compared to low conflicts65. The lack of data regarding interval estimates, used as a proxy for the sense of agency, precluded from studying with a sufficient statistical power the relationship between prosocial disobedience and the sense of agency. Critically, we indeed had to exclude a larger number of participants in the interval estimate task due to a failure to discriminate between millisecond intervals compared to previous studies66. This unexpected difficulty is unlikely to be due to comprehension since all participants were explained the task in their native language. It is also unlikely that participants were not motivated to perform the task correctly since they largely reported a strong willingness to help researchers to obtain accurate data. One explanation could be related to different processing strategies in different cultures, since former samples were composed in majority of western individuals67. However, this possibility is only an assumption as it has never been investigated in the scientific literature.We observed that a higher feeling of responsibility was associated with a higher prosocial disobedience rate. This result supports previous studies showing that feeling responsible has a positive influence on prosocial behaviours35, as the sharing of vicarious pain prevents aggression and promotes help69. The present study indicates that empathy for pain could also support the possibility to resist orders to hurt another person.We also observed that a higher neural response to the pain of others was associated with a greater prosocial disobedience. Many studies have shown that feeling empathy for the pain of others has a positive influence on prosocial behaviors51. It thus suggests that the more people feel aversion for the pain of others, the more likely they will refuse orders to inflict pain to another person.We further observed that people scoring high to the harm subscale of the moral foundation questionnaire had a higher prosocial disobedience rate. The harm subscale is theoretically defined as being related to our evolution, which involved an ability to feel and dislike the pain of others41. We nonetheless observed that a higher reported family suffering was also associated with a higher neural response to the pain of others. Other interpretations are thus possible. On the one hand, it may be the case that a high family suffering involved a higher sensibilization to the suffering of others71, thus leading to more prosocial behaviors. One the other hand, people having a higher neural response to the pain of others could also estimate the suffering of their own family as higher. Future research is thus necessary to better understand the link between family suffering during a genocide and obedience to immoral orders.Finally, we observed that the more their family suffered during the 1994 genocide, the more this first generation would resist immoral orders. A possible interpretation to this effect is that individuals coming from families that were strongly impacted by the genocide would be less likely to perpetrate acts of obedience, which are described as a critical factor explaining the genocide72. Importantly, those effects could also be influenced by the cultural relationship to authority and the reported family suffering during the genocide. Our study thus revealed critical cognitive factors involved in prosocial disobedience. However, due to the lack of past literature, the precise influence of each of those factors on prosocial disobedience and to what extent those factors are mutually exclusive or inclusive should still be determined.Altogether, those results suggest that several neuro-cognitive processes occurring at different moments during an act of obedience to immoral orders can influence prosocial disobedience. As a resume, we observed that a low processing of the instructions of the experimenter, a high degree of conflict before obeying the orders to send a shock to the victim, a higher neural response to the pain of others and a high feeling of responsibility were associated with a higher prosocial disobedience rate see Fig. . Caution38. One possibility is that the populations between this previous study and the present study were highly different. While the population tested in Caspar38 was composed of western individuals, the population tested in the present study was composed of individuals with a family and national history strongly influenced by the genocide. It may thus be the case that social and individual dimensions supporting disobedience differ between these two populations. This also underlies the importance for social neuroscience research to avoid studying only WEIRD  populations in their sample in order to broaden its conclusions to more diverse human beings. We also observed that explicitly offering participants the possibility to disobey did not influence the results in variant 2. This may reflect a general tendency of following authorities as a personal choice.We did not observe a significant difference in prosocial disobedience between the different variants of the same task. The presence or the absence of the monetary gain did not influence the results. This result could be explained by the amount of money per se ; a higher monetary reward would have maybe led to a greater difference in obedience. However, in a former study with a similar paradigm, offering a monetary reward or not did influence prosocial disobedience73. However, that study only relied on fictitious scenarios presented through questionnaires, thus preluding the possibility to investigate behavioral changes. In our study, the frequency to which individuals participate in reconciliation activities did not influence prosocial disobedience. A critical difference is that none of our participants were reminded about such peace messages prior to their participation in the study.A previous study conducted in Rwanda indicated that listening to peace building radio programs did not necessarily involve a cultural change in deference to authority, but induced changes in behaviors, with listeners being more likely to defer to local officials for the resolution of problems38 and suggest that thinking that disobedience is the main aim of the study is not statistically associated with prosocial disobedience.In the present study, we did not directly assess whether or not our participants knew about the experiments of Stanley Milgram. One could expect that knowing Milgram would prevent people to obey and that it could account for differences between groups. In the present study, we asked each of our volunteers if they disobeyed because they thought it was the main of the study, thus indirectly targeting Milgram’s studies on disobedience. Results indicated that the two groups did not differ in their ratings on this question. Further, ratings on this question were statistically not associated with prosocial disobedience. Those results confirmed a previous study74. Also, the political system strongly differs between Belgium and Rwanda, an aspect that could influence or reflect a general compliance with the hierarchy.We acknowledge that our study lacks a critical factor that would control for in-group or intergroup attitudes within our pairs of Rwandese participants. For legal and ethical reasons in Rwanda, variables related to ethnicity cannot be measured4 and with a previous study showing that the effect of Gender on prosocial disobedience was inconclusive38.In the present study, we also had a confound between site of the experiment  and Gender, as we failed to recruit an equal number of female and male participants in Rwanda. However, results indicated that prosocial disobedience was not influenced by gender. These results are consistent with Milgram’s studies showing no difference between men and women75.As our design implied a role reversal procedure, one could expect that the role of the role has an effect on the results. However, statistical analyses showed that order of the role never conclusively influenced the results, which is consistent with past studies using a relatively similar procedureFuture studies could also refine the questions asked regarding the family trauma. For instance, regarding the questions related to the number of family members who died and suffered during the genocide, we realized that those were very difficult questions to answer for the majority of volunteers, and for several reasons. First, it is common in Rwanda for individuals not to know precisely what happened to their relatives during the genocide. Second, several volunteers reported that they only very rarely talked with their relatives about what happened in 1994. The topic remains sensitive for the majority of families, which avoid speaking about the genocide.37. Subsequent variants were adapted regarding ethical standards6, but were not adapted to neuro-cognitive measurements. There is thus still a long path to understanding the mechanisms supporting prosocial disobedience. As we see in the present study, several factors can influence individual decisions to disobey orders to harm another person, which show the complexity for understanding better human behaviors.The present study is one of the first that investigated the neuro-cognitive processes and the temporal dynamics at the neural level, together with cultural, social and psychological factors, that are associated with prosocial disobedience. The lack of previous literature on such question is probably due to the fact that the scientific community largely avoided to conduct research on disobedience after the ethical concerns associated with Milgram’s studies76 or dehumanization77. For instance, as the pain induced in our experimental set-up did not involve any long-term effects, we advise against conducting inferences about the extent to which the results observed predict or reflect similar behavioral conduct in real life. Moreover, participants in this study are not likely to represent the population that committed the genocide. The aim of the present study was to identify factors that influence prosocial disobedience, by suggesting that perhaps those factors also contribute to prosocial disobedience in real life.In conclusion, it is important to remember that there is a significant gap between obeying immoral orders in an experimental set-up and participating in a massacre. The significant prevalence of obedience behaviors in a sample tested in Rwanda does not necessarily imply causality with the genocide. A range of determining contextual factors also have to be considered, such as economic conditionsSupplementary Information.


Computer software for the analysis and extraction of high-energy surface X-ray diffraction data is presented. HAT), an open-source cross-platform software package written in Python to allow the extraction and processing of high-energy surface X-ray diffraction (HESXRD) data sets. Thousands of large-area detector images are collected in a single HESXRD scan, corresponding to billions of pixels and hence reciprocal space positions. HAT is an optimized reciprocal space binner that implements a graphical user interface to allow the easy and interactive exploration of HESXRD data sets. Regions of reciprocal space can be selected with movable and resizable masks in multiple views and are projected onto different axes to allow the creation of reciprocal space maps and the extraction of crystal truncation rods. Current and future versions of HAT can be downloaded and used free of charge.This work introduces the high-energy surface X-ray diffraction analysis toolkit ( The intensity of the CTR at this position is then simply proportional to the area under the peak and can be corrected by applying a series of correction factors and averaging symmetrically equivalent data points  is an established technique for the determination of surface structures  shows an example of such a scheme for the same Pt(111) sample. A more advanced approach could involve fitting some function like a 2D Lorentzian with a sloping background plane. This requires additional competence in image analysis (e.g. in Python or ImageJ) and is also difficult to automate, often requiring manual inspection of each image. Such a high overhead for simply extracting intensities has significantly increased the ‘measurement to publication’ time of surface diffraction experiments, and in some cases resulted in the data only being partially analyzed.Currently, 2D (or area) detectors have almost completely replaced point detectors, as they can simultaneously measure the signal and background, allowing fast scans along a given direction in reciprocal space. Area detectors also make it easier to identify sources of unwanted signals such as powder rings, Bragg peaks and diffuse scattering. These detectors have significantly improved, with newer generations having higher resolution, lower noise, better dynamic range and faster acquisition. Until very recently, most area detectors available at beamlines with sufficient sensitivity for surface diffraction had up to ∼300 000 pixels, with vertical and horizontal pixel sizes between 50 and 150 µm, depending on the type. The data collected from such experiments are then a sequence of images around 0.5–1 MB each (a few gigabytes per experiment). The computational challenge of extracting useful SXRD data from such images is increased considerably compared with that for data measured with a point detector. The most basic solution is to sum a region of interest around the CTR signal and then subtract the sum of some representative background regions; Fig. 1BINoculars from the ESRF is a very successful example of such an approach which has been implemented across several beamlines  approach is to perform reciprocal space binning, where the 3D reciprocal space volume is divided into voxels. The intensity of each pixel, in each image after assignment of reciprocal space coordinates, is placed in the corresponding voxel or ‘bin’; this is essentially a 3D histograming process. et al.  enables exploration of the data sets on a moderately fast laptop or desktop PC (we recommend at least 64 GB of RAM), allowing various reciprocal space slices and profiles to be extracted using draggable masks. Reciprocal space binning calculations like those carried out in BINoculars can be performed and are accelerated using the Numba library  and then a grazing-incidence angle  is chosen. Large-area detector images can then be collected while the sample is rotated about the surface normal. Since the Bragg peaks of the single crystal are many orders of magnitude brighter than the CTRs of interest, beam stops such as tungsten pieces attached to magnets are used to block out the intense Bragg peaks. We refer to each image collected during the rotation of the sample as a ‘frame’, and this corresponds to a particular sample rotation angle (ϕ) recorded by the diffractometer encoder. The whole set of images is called an ‘image stack’. Depending on the detector type, we may wish to subtract a dark image from each frame. Furthermore, a background image, such as the sample environment without the sample, can be subtracted and this may also have its own dark image. Each image collected can also be normalized to a beam intensity monitor, such as an ion chamber or the synchrotron ring current. This image stack representation is presented schematically in Fig. 2HAT implements the image stack as a Python class to allow the greatest degree of flexibility. For instance, it is possible to construct a composite detector image consisting of two detectors side by side with a small gap between them. This makes no difference to the rest of the HAT software (in the future we hope to extend this to support more combinations). The image stack class supports initial binning of the frames to a smaller number of pixels (this is useful if the computer has insufficient memory), transformations such as flipping/rotation and intensity offsets/scaling. HAT makes extensive use of the PyQtGraph library to provide many features  is the viewport from which the user can choose between several different views using the ‘View’ menu. The view shown in Fig. 3M NaOH at a potential of 0.1 V (versus RHE); the full 72° rotation collected on this sample will later be used as an example throughout the manuscript. In the summed image [Fig. 4b)] the background dominates, whereas the CTRs are clearly visible as straight vertical lines between the beam stops in the maximum image [Fig. 4a)]. Next to the CTRs are straight lines due to herringbone surface reconstruction. The area selected is chosen either by moving the sliders labeled (b) in Fig. 3c). Similarly, the color scale can be adjusted either with the sliders (d) or by changing the ‘Cmin’ and ‘Cmax’ values (e). The color mapping can be chosen by right-clicking on the widget (f). User messages and the progress of certain operations are given in the status bar (g). The coordinates plus intensities of individual pixels (when hovered over) are displayed at the top (h). Various tools such as box profiles and mask tools are accessible from the tool bars (i) and (j), and experimental parameters can be set in the parameter tree (k). Box profiles  can be extracted in any view to show how the intensity varies along any given direction. These can also be converted to traditional rocking scans, in which for each pixel along the vertical direction  a column with the intensity for each angle in the selected angular range is exported, as well as appropriate correction factors. The user can then integrate these rocking curves in the traditional manner to obtain structure factors. We have also found this view useful when performing experiments, in that one can easily load a data set and use the sliders to determine a scan range for future scans. Any masks selected in this view are exclusive and pixels inside the masks will be ignored when binning, which is useful for ignoring detector gaps and dead pixels.Fig. 32.2.HAT corrects for this distortion and assigns reciprocal space coordinates to the image shown in the detector view. The conversion of pixel position to reciprocal space coordinates has been described numerous times ], we define the angle γ as the azimuthal angle lying along the x axis and δ is the altitude along the z axis . The scattering vector is simply Q = kf − ki. In the more natural coordinates of the sample surface [Fig. 5b)], we can also define the incidence angle of the beam as α and the vertical exit angle as β, the in-plane angle being ψ and the rotation of the sample being ϕ. It is assumed that the sample surface normal has previously been aligned to coincide with the laboratory z axis and α is a known angle later applied. In the case of the two reference frames coinciding (when α = 0), the β and ψ angles of each pixel can be calculated via simple trigonometry, as given in equations (1)x and Δz are the distances along those directions, and d is the distance between the sample and the detector:b), using the standard angle component form of a vector:i is the in-plane incidence angle, which is 0, and k0 = 2π/λ. Now we have the individual components of the scattering vector for each pixel:yq component and a small xq component. A suitable x axis is thenQ is selected as the reciprocal unit), HAT generates a set of rq and zq coordinates for each pixel on the detector. This set of coordinates and the associated intensities  are then interpolated onto a grid. Fig. 6a) shows such an interpolated image. Note that there is a missing section in the middle of the detector around rq = 0. This is sometimes referred to as the ‘missing wedge’ and arises from mapping the Ewald sphere to the 2d detector plane. Without it the rods would curve at the top of the detector image.b)]. The condition for this to make sense in surface coordinates is that the conversion between rq and zq is simply the Q component divided by the reciprocal lattice vectors. Therefore, HAT allows the conversion to RLU when the angles of the two in-plane lattice vectors α1 = α2 = 90°. Then the vertical axis is L = zq/b3 and the horizontal axis isHAT are that the real space lattice vector magnitudes are ia with angles αi, and the reciprocal space vectors ib with angles βi. These can be entered in the parameter tree . These were used to generate the in-plane map shown in Fig. 9b). In this map it is clear that the CTRs are close to the integer positions, and they are surrounded by additional spots due to the herringbone surface reconstruction which has previously been shown to be present under these conditions  shows two magnified views around the (2 −1) and (−1 1) CTR positions, where the additional hexagon of spots surrounding the CTR due to the herringbone reconstructions is visible. Each pixel can also be assigned reciprocal space coordinates and binned onto a 3D grid (into voxels). Masks selecting the whole of the transformed detector and in-plane views [Figs. 9a) and 9b)] were then selected and used to produce a 3D representation of the reciprocal space volume collected during the 72° rotation [Fig. 9d)]. A smaller in-plane section was chosen around the (1 0) CTR and used to produce the volume shown in Fig. 9e). One can see the intensity around of the central CTR and several rods around it due to the herringbone surface reconstruction.To create the 2D projection, an array is created in the computer memory where the number of bins (elements) along each of the coordinate directions is specified by the user. We define the number of bins as 2.5.HAT. The first is to use the profile tool to extract rocking scans and then fit the area under the peaks using another program such as Ana-Rod. Secondly, one can select a small angular range over a CTR using the angle range sliders [Fig. 2b)], change the intensity mode to the mean and then take a profile along the CTR in transformed detector view with intensity corrections enabled. This should be followed by the selection of similarly sized angular ranges either side to measure the background. The third method is to place a mask around the CTR on an in-plane map, which can then be projected onto either a xqzq or yqzq plane, and then a line profile along the zq direction can be used to extract the CTR. Background regions can then be selected by moving the mask on the in-plane map to an adjacent region or taking profiles either side of the CTR. This method was used to extract the (2 −1) CTR shown in Fig. 10d) (green markers). The last method is used to generate a 3D view of the CTR [Fig. 10a)] which can then be exported as a 3D NumPy array. The user can then break the array into slices and extract the intensity by fitting a 2D peak to the CTR signal or using regions of interest [Fig. 10c)]. Other methods such as peak restoration can also be applied here  and 10c) to fill in gaps. The intensity along the CTR extracted this way is shown in Fig. 10d) (red markers) and compares well with the previous method. The intensities of the CTRs in Fig. 10d) dip close to the anti-Bragg positions (between dashed lines). This is due to the interference caused by the surface atoms transitioning between the hexagonally close packed site and the face-centered cubic site.There are multiple ways one can extract CTRs using 3.HAT, a graphical software package that not only allows the rapid assessment of HESXRD data sets but is also a complete reciprocal space binning solution that can be used to create a variety of projections and extract CTRs or other line profiles. HAT employs a system of user-selected masks to give precise control over which parts of reciprocal space are included. It is also scriptable and can output publication-quality figures via a Matplotlib interface. The software can be accelerated with a GPU and can also run on a laptop computer. We hope that HAT will significantly reduce the workload in analyzing HESXRD data.Here we have presented 4.https://github.com/gary-harlow/HESXRD-Analysis-Toolkit. The package is also available to install directly from The Python Package Index (PyPI), typically using the command: $ pip install xrayhat. The example data set (the raw detector images and metadata files) used in this manuscript is freely available for download from the figshare repository  and all future versions can be accessed free of charge under the MIT License from


Devices having different masses can alter the features of the hand tremor spectrum and their mutual comparisons can be prejudiced.Tremors are common disorders characterized by an involuntary and relatively rhythmic oscillation that can occur in any part of the body and may be physiological or associated with some pathological condition. It is known that the mass loading can change the power spectral distribution of the tremor. Nowadays, many instruments have been used in the evaluation of tremors with bult-in inertial sensors, such as smartphones and wearables, which can significantly differ in the device mass. The aim of this study was to compare the quantification of hand tremor using Fourier spectral techniques obtained from readings of accelerometers built-in a lightweight handheld device and a commercial smartphone in healthy young subjects. We recruited 28 healthy right-handed subjects with ages ranging from 18 to 40 years. We tested hand tremors at rest and postural conditions using lightweight wearable device (5.7 g) and smartphone (169 g). Comparing both devices at resting tremor, we found with smartphone the power distribution of peak ranging 5 and 12 Hz in both hands. With wearable, the result was similar but less evident. When comparing both devices in postural tremor, there were significant differences in both frequency ranges in peak frequency and peak amplitude in both hands. Our main findings show that in resting condition the hand tremor spectrum had a higher peak amplitude in the 5–12 Hz range when the tremor was recorded with smartphones, and in postural condition there was a significantly ( It is considered common disorder2 and is typically the most recurrent symptoms of movement disorders3. In summary, there are two types of tremors: normal tremors inherent in the physiological behavior of the human body and abnormal tremors that are commonly related to certain pathological conditions4, such as Parkinson's disease (PD) and essential tremor (ET)6.Tremor is an involuntary, relatively rhythmic oscillation that occurs anywhere in the body8; and provided important differentiation tools for clinical purposes9. While resting tremors appear when the hand is relaxed, without intentional action of the muscles10, postural tremor occurs through voluntary contraction of the muscles to maintain the position against gravity4.Previous studies investigated these tremors by recording their presence during rest and postural conditions11 and many methods have been used in the literature, such as electromyography, video recordings, and inertial sensor recordings22.There is no gold standard assessment method for identifying tremors23. They generate a large and detailed amount of data ready to be statistically analyzed from clinical or laboratory practices in patients experiencing motor disorders. Inertial sensors, such as accelerometers and gyroscopes, are included in wearable devices and smartphones, and many applications of these instruments have been developed to quantify tremors. Table Inertial sensors are practical, light, highly precise, and highly efficient32. The spectral peak frequency of the tremor has a linear relationship with the reciprocal of the square root of the added mass. This information led us to question the similarities between the quantification of tremors using smartphones and wearable devices. Usually, wearable devices weigh several grams while smartphones weigh hundreds of grams. Our hypothesis is that this difference in their mass can potentially lead to misclassifications of the tremor.Previous studies have reported that mass loading at the location where the tremor is measured affects the spectral distribution of the tremor powerThus, in the present investigation, we aimed to compare the quantification of hand tremor using Fourier spectral techniques obtained from a lightweight portable device and a commercial smartphone in healthy young subjects.All subjects present in this study voluntarily agreed to participate with informed and written consent. All procedures were approved by the Research and Ethics Committee of the Federal University of Pará (Report #1.338.241). We confirm that all research was performed in accordance with Declaration of Helsinki, and informed consent was obtained from all participants.33 . None participant reported the correction in the use of the dominant hand during the childhood. All participants were young, healthy, and right-handed adults aged 18–40 years. None of the participants had a history of neurological or systemic diseases, self-reported hand tremors that made it difficult to carry out daily activities or used any medication that caused tremors.The study was carried out with 28 participants  recruited for convenience. The laterality of the participants was established according to the short-form version of the Edinburgh Handedness Inventory35 was used to start and finish the smartphone sensor recording. The acquisition frequency of the accelerometer  on the mobile device was 50 Hz.Hand tremors were recorded using wearable device and smartphone Fig. . The weaHand tremor was recorded with both devices under four conditions: dominant hand and resting position, dominant hand and postural position, nondominant hand and resting position, and dominant hand and postural position. To perform the recording, the participant was asked to sit upright in a chair with the side of the body to be tested sitting parallel to a table (at a comfortable height) to allow the arm to relax between tests. The resting position consisted of keeping the hand off the table in a hanging position. To record the tremor in the postural position, the participant was asked to keep their fingers relaxed in the neutral position, the wrist in the neutral position, elbow fully extended, and the shoulder in a 90° flexion and 0° abduction position. The smartphone and the wearable device were fixed in the dorsal region of the hand, in the middle of the third metacarpal, between the carpus and the digital ends of the metacarpal, using double-sided tape. Figure t-test was used to compare the peak frequency and peak amplitude of hand tremors using both ranges of frequency of each device. The effect size was calculated using Cohen’s d and was considered the Cohen effect size classification as ignored (d ≤ 0.2), small (d ˃ 0.2 and d ≤ 0.5), and medium (d ˃ 0.5 and d ≤ 0.8), and large (d > 0.8). SPSS software was used for statistical analysis. A level of significance of 0.05 was considered for all analyses.Scripts programmed in the MATLAB/Octave language  to process the inertial signals obtained by the devices. The first and last 5 s of the inertial recordings were excluded from the analysis. The inertial signals were subjected to a detrend protocol to remove the effect of linear trends on the time series. Subsequently, the time series were submitted to a second-order zero-lag Butterworth filter, bandpass between 0.1 and 20 Hz. To extract features in the frequency domain, a fast Fourier transform (FFT) was applied to estimate the peak frequency of the spectrum and the peak amplitude in the ranges of 0.1–5 Hz and 5–12 Hz. A paired Student’s p < 0.001, Cohen’s d = 0.97), and another significant difference was observed in the peak amplitude at the range 5–12 Hz, in which spectrum of the tremor obtained using smartphone (mean ± SD = 44.37 ± 30.3) had higher amplitudes than that obtained using the wearable . For the dominant hand, we found a significant difference in the peak amplitude in the range of 5–12 Hz, in which the peak amplitude obtained with the smartphone (mean ± SD = 56.85 ± 54.2) was greater than that obtained with the wearable device .The mean and dispersion (1 standard deviation) of the spectrum of the tremor of the resting hand (of the dominant and non-dominant hands) recorded by wearable and smartphone devices are shown in Fig. p < 0.001, Cohen’s d = 1.24; peak frequency: mean ± SD = 7.06 ± 1.92; p = 0.007, Cohen’s d = 0.64). Regarding the nondominant hand, the smartphone recordings had a larger peak amplitude (mean ± SD = 89.13 ± 35.3) than the recordings from the wearable devices .Figure 31. Our main findings were that the tremor spectrum obtained from both devices differed depending on the spectrum range, handedness, and position of the segment during testing. These results have significant implications for the comparison of tremors obtained using smartphones and wearable devices.The motivation for this research is to assess whether the addition of devices with different masses, such as smartphones and lightweight wearable devices, would modify the characteristics of inertial recording of tremors, as observed in previous studies that investigated the hand and fingers38. In summary, the hand tremor had a single peak without additional mass, and with the addition of mass, most participants had tremors with a double-peaked spectrum (with little or no influence of the mass loading on the tremor amplitude). Our hypothesis is that with the use of smartphones (devices with a dozen of grams), participants would experience conditions that are more similar to the experimental conditions of mass loading than during the use of the lightweight wearable device (devices with few grams). Furthermore, the tremors obtained using smartphones would present changes similar to those observed in the experiments with mass loading.It is well known that mass addition to the segment to be recorded leads to a change in the acceleration power distribution of the tremor spectrum24. In the present study, the smartphone had approximately 169 g and was associated with spectral peak reduction of a few units of frequency, which was expected to be smaller than that reported previously24. We also observed that with smartphone loading, especially in the dominant hand, the mean spectrum was double-peaked, with one component peaking in the range between 6 and 8 Hz, and another component peaking in the range between 8 and 10 Hz. On the contrary, while using lightweight wearable devices, the tremor was characterized by a single peak in the range between 6 and 8 Hz. In the low-frequency range, we observed a higher peak frequency for the smartphone spectrum than that for the wearable spectrum. These findings likely reflect the spread of the high energy found in the high-frequency range observed in the spectra of the smartphone.Our findings partially confirmed our expectations. Under the rest conditions, we observed a numerical and nonsignificant reduction of the spectral peak in the range of 5–12 Hz for the recordings obtained using a smartphone compared to wearable devices for both hands. It was found a reduction of 2 Hz in the spectral peak after a 300 g loadingDuring postural conditions, the tremor we recorded probably involved a mixture of tremors from different parts of the upper limb. We observed a narrow power distribution in the low frequency range, likely representing the tremor of the proximal parts of the upper limb, in addition to a broad power distribution in the high frequency range, representing the tremor of the distal parts of the upper limb. The main difference between the tremor spectra obtained from the smartphone and the wearable devices resided in the power distribution in the high frequency range. There were no significant differences between devices between the peak power and peak frequency in the low-frequency range; however, the peak power in the high-frequency range was larger in the tremor spectrum from the smartphone recordings than in the wearable recordings for both hands. Furthermore, we found a significantly higher peak frequency for smartphones than for wearables on the dominant and non-dominant hands.39. Some authors have investigated tremors with portable, noncontact tremor vibration measurements in the hand40. Considering various multiple devices that are commercially available, the different weights they can present and the possible change in the signal spectrum they can cause, it would be interesting to inform the mass of the devices in the investigation of body tremors.The mass of the device during a hand tremor test has previously been discussed as a possible response to the results found in the extended posture test, particularly in comparison with the dominant and nondominant hands41. Furthermore, no participant had any disease in our experiments and future investigation with patients suffering from different diseases that affected the hand tremor is necessary.The present study had limitations with respect to the number of devices with different masses used to quantify tremors. For future investigations, it would be of great value to perform several measurements of limb tremor with several smartphones or wearable devices (with different masses) in order to compare possible differences in the spectral characteristics of their signals. The generalizability of the present study was also limited by the age range of our sample comprised by young healthy subjects. Physiological tremor, especially in the postural component, has been shown to be affected by aging and by chronic non-neurological conditions that are very common in the general population In the present investigation, we placed the devices in the dorsum of the hand. Although it has been previously used, this placement is quite acceptable for assessments in the laboratory or, to a lesser extent, at home, but not for long-term daily recordings. For long-term recordings of tremor, it is reasonable to explore the promising potentialities of wearable inertial measurement units and the placement in the different body segments of the patients.Our investigation has no information about basal condition  of physiologic tremor. We considered that the few grams of the lightweight wearable device could approximate this basal condition. A more controlled approach could use an electromyographic recordings associated to the inertial recordings during no mass loading condition, lightweight wearable loading, and smartphone loading.43. Essential tremor has a similar power distribution compared to the physiological tremor represented by a mechanistic component at 5–12 Hz31. However, as previously discussed, the mass loading decreases the maximum power of the mechanical resonance of the tremor, allowing identification of the neural component of the essential tremor40.Many clinical investigations have reported the importance of mass loading for the evaluation of essential tremorThus, the use of a device with higher mass, such as smartphones, could improve the correct identification of neurological tremors. The use of built-in accelerometers inside portable devices, such as smartphones and wearable devices, opens a new window of opportunity for a low-cost and objective evaluation of physiological and pathological tremors for people with different social conditions and can be an important tool for health care in the future. Comprehension of the evaluation results obtained using these different portable devices is necessary to improve their validity for clinical use.