Hi Anton and Christoph,
 I find a performance issue:  for 6 leads with around 600 sites, and the scattering region with around 5000 sites the call
gauge = kwant.physics.magnetic_gauge(sys)

takes many minutes to run.    So,  the above command takes more time than the actual calculation that follows and more time than required to set up and plot the system.
What is the expected size scaling  of  magnetic_gauge calculation?

Best wishes,

Sergey