Skip to content
Snippets Groups Projects
  1. Aug 01, 2023
  2. Jun 30, 2023
  3. Jun 29, 2023
  4. Jun 23, 2023
  5. Jun 21, 2023
  6. Mar 17, 2023
  7. Mar 15, 2023
  8. Mar 13, 2023
  9. Mar 12, 2023
  10. Feb 24, 2023
  11. Jan 10, 2023
  12. Jan 04, 2023
  13. Dec 16, 2022
  14. Sep 13, 2022
  15. Jun 02, 2022
  16. May 25, 2022
  17. May 23, 2022
  18. May 19, 2022
  19. May 13, 2022
  20. May 10, 2022
  21. Apr 20, 2022
  22. Apr 13, 2022
    • Wuttke, Joachim's avatar
      d322d986
    • Wuttke, Joachim's avatar
      corr · 6c1be7a6
      Wuttke, Joachim authored
      6c1be7a6
    • Wuttke, Joachim's avatar
      auto update many examples; many tests broken · a4920b13
      Wuttke, Joachim authored
      def user_edit(fn, t):
      
          t = re.sub(r'def get_simulation\(sample\):',
                     'def get_simulation(sample, **simargs):', t)
      
          N = 0
          xx = r'\n((\s+?)\w+ = ba\.\w+?Detector)\((\d+), (.+?, .+?), \d+, (.+?, .+?)\)'
          m = re.search(xx, t)
          if m:
              N = int(m.group(3))
          t = re.sub(xx, r"\n\2n = simargs['n']\n\1(n, \4, n, \5)", t)
      
          xx = r'(\w+ = ba\.\w+?Detector)\((\d+), (.+?, .+?, .+?)\)'
          m = re.search(xx, t)
          if m:
              N = int(m.group(2))
          t = re.sub(xx, r"\1(simargs['n'], \3)", t)
      
          xx = r"(if __name__ == '__main__':\n)((.*?\n)+?)(\s+\w+ = get_simulation\(\w+)\)\n((.*?\n)*?)\s+bp\.plot_simulation_result\(simulation\.simulate\(\)\)"
          t = re.sub(xx, r"\1" +
                     "    plotargs, simargs = bp.kwargs_from_cmdline(sim_n=" + str(N) + ")\n" +
                     r"\2" +
                     r"\4, **simargs)\n"
                     r"\5" +
                     "    result = simulation.simulate()\n" +
                     "    bp.plot_simulation_result(result, **plotargs)", t)
      
          return t
      a4920b13
  23. Apr 08, 2022
  24. Feb 26, 2022
  25. Dec 03, 2021
  26. Sep 22, 2021
  27. Aug 03, 2021
  28. Aug 02, 2021
Loading