vsoch / gridtest

grid parameters and testing for Python modules and functions
https://vsoch.github.io/gridtest/
Mozilla Public License 2.0
2 stars 1 forks source link

gridtest grid inputs should be generate-able via a function #13

Closed vsoch closed 4 years ago

vsoch commented 4 years ago

For example, see the animate functions here that use smaller functions to generate input arrays. We should be able to specify that.

vsoch commented 4 years ago

Here is a dummy example:

  schrodinger.Schrodinger:
  - grid:
      x:
        list: [[1, 2, 3], [1, 2, 3]]
      V_x:
        func:
          - name: schrodinger_helpers.generate_V_x
            args:
              param1: ...
              param2: ...

I think the nested params would be in the grid format as well, so we'd want to add a "value" index in case a grid isn't needed but just to set a single value.

vsoch commented 4 years ago

More work on this last night, I think a testing file should have another level of "grids" to go alongside "tests" that can essentially be piped into a test section. For example:

schrodinger:
  filename: /home/vanessa/Desktop/Code/pySchrodinger/schrodinger.py
  grids: # each value evaluated to a list of terms
    yourlist:
      grid:
        name:
          list: [1, 2, 3]
          min: 10
          max: 20
    say_hello:
      func: schrodinger_helpers.say_hello
      args:
        name: Vanessa
    generate_V_x:
      func: schrodinger_helpers.generate_V_x
      grid:
        x:
          min:
          max:
        one:
          value: 1.0

# gridtest add function generate_V_x

    generate_V_x_2:
      name: schrodinger_helpers.generate_V_x
      grid:
        V_x:
          function: generate_V_x_1
      args:
        x: 1.0
        one: 1.0

  tests: 
    Schrodinger.solve:
    - grid:
        V_x:
           setup: generate_V_x_2
           list: [1, 2, 3]
        name: mylist 
      args:
        x: 1.0
        one: 1.0

    Schrodinger.solve:
    - args:
        Nsteps: 0.001
        dt: 1
        eps: 1000
        max_iter: null
      result: 10 

I'm not sure what to call the reference to a grid, a double grid seems redundant.