Exemplo n.º 1
0
def gui(ctx):
    """
    Shows a GUI for manual calibration
    """
    from spotpy.gui.mpl import GUI
    setup = ctx.obj
    gui = GUI(setup)
    gui.show()
Exemplo n.º 2
0
Needs at least Python 3.5
"""

from __future__ import division, print_function, unicode_literals

import spotpy
from spotpy.gui.mpl import GUI
from spotpy.examples.spot_setup_hymod_python import spot_setup
from spotpy.objectivefunctions import rmse

if __name__ == '__main__':
    setup_class = spot_setup(rmse)

    #Select number of maximum allowed repetitions
    rep = 10000

    # Create the SCE-UA sampler of spotpy, alt_objfun is set to None to force SPOTPY
    # to jump into the def objectivefunction in the spot_setup class (default is
    # spotpy.objectivefunctions.rmse)
    sampler = spotpy.algorithms.sceua(setup_class,
                                      dbname='SCEUA_hymod',
                                      dbformat='csv',
                                      alt_objfun=None)

    #Start the sampler, one can specify ngs, kstop, peps and pcento id desired
    #sampler.sample(rep,ngs=10, kstop=50, peps=0.1, pcento=0.1)

    gui = GUI(spot_setup())
    gui.show()
 def test_run(self):
     setup = Setup()
     with GUI(setup) as gui:
         gui.clear()
         gui.run()
         self.assertEqual(len(gui.lines), 2)
 def test_sliders(self):
     setup = Setup()
     with GUI(setup) as gui:
         self.assertEqual(len(gui.sliders), 4)
 def test_setup(self):
     setup = Setup()
     with GUI(setup) as gui:
         self.assertTrue(hasattr(gui, 'setup'))
Exemplo n.º 6
0
                # Raises if the runtime is too long
                reporter(t)
        except RuntimeError as e:
            sys.stderr.write(str(par))
            sys.stderr.write(str(e))

        return result


if __name__ == '__main__':
    print(spotpy.__file__, spotpy.__version__)
    if len(sys.argv) > 1:
        runs = int(sys.argv[1])
    else:
        runs = 1

    model = Cmf1d_Model()
    print(spotpy.describe.setup(model))
    if runs > 1:
        parallel = 'mpi' if 'OMPI_COMM_WORLD_SIZE' in os.environ else 'seq'
        sampler = spotpy.algorithms.mc(model,
                                       dbformat='csv',
                                       dbname='cmf1d_mc',
                                       parallel=parallel,
                                       save_sim=False)
        sampler.sample(runs)
    else:
        from spotpy.gui.mpl import GUI
        gui = GUI(model)
        gui.show()