Пример #1
0
    def run_nmcm(self):
        self.status_label[
            "text"] = "Status: running monte carlo simulations..."
        self.status_label.update_idletasks()
        self.kappa_button["state"] = DISABLED

        closespace = float(self.nmcm_close_space_entry.get())
        closetime = int(self.nmcm_close_time_entry.get())
        spatialdomain = float(self.nmcm_spatial_domain_entry.get())
        temporaldomain = int(self.nmcm_temporal_domain_entry.get())
        startnumber = int(self.nmcm_start_number_entry.get())
        endnumber = int(self.nmcm_end_number_entry.get())

        for birdnumber in range(startnumber, endnumber):
            self.status_label[
                "text"] = "Status: running monte carlo simulations with %s birds..." % birdnumber
            self.status_label.update_idletasks()
            dycast.create_dist_margs(closespace, closetime, spatialdomain,
                                     temporaldomain, birdnumber, birdnumber)

        self.status_label[
            "text"] = "Status: calculating cumulative probabilities, almost finished..."
        self.status_label.update_idletasks()
        dycast.calculate_probabilities()

        self.kappa_button["state"] = NORMAL
        self.status_label["text"] = "Status: ready"
        self.status_label.update_idletasks()
Пример #2
0
    def run_nmcm(self):
        self.status_label["text"] = "Status: running monte carlo simulations..."
        self.status_label.update_idletasks()
        self.kappa_button["state"] = DISABLED
        
        closespace = float(self.nmcm_close_space_entry.get())
        closetime = int(self.nmcm_close_time_entry.get())
        spatialdomain = float(self.nmcm_spatial_domain_entry.get())
        temporaldomain = int(self.nmcm_temporal_domain_entry.get())
        startnumber = int(self.nmcm_start_number_entry.get())
        endnumber = int(self.nmcm_end_number_entry.get())
        
        for birdnumber in range(startnumber, endnumber):
          self.status_label["text"] = "Status: running monte carlo simulations with %s birds..." % birdnumber 
          self.status_label.update_idletasks()
          dycast.create_dist_margs(closespace, closetime, spatialdomain, temporaldomain, birdnumber, birdnumber)

        self.status_label["text"] = "Status: calculating cumulative probabilities, almost finished..."
        self.status_label.update_idletasks()
        dycast.calculate_probabilities()
        
        self.kappa_button["state"] = NORMAL
        self.status_label["text"] = "Status: ready"
        self.status_label.update_idletasks()
p.add_option('--endnumber', default=100, type="int")

p.add_option('--config',
             '-c',
             default="./dycast.config",
             help="load config file FILE",
             metavar="FILE")

options, arguments = p.parse_args()

config_file = options.config

try:
    dycast.read_config(config_file)
except:
    print "could not read config file:", config_file
    sys.exit()

dycast.init_logging()

dycast.init_db()

if options.startnumber > options.endnumber:
    print "value for startnumber must be less than or equal to endnumber"
    sys.exit()

dycast.create_dist_margs(options.closespace, options.closetime,
                         options.spatialdomain, options.temporaldomain,
                         options.startnumber, options.endnumber)

dycast.calculate_probabilities()
p.add_option('--temporaldomain', default=21, type="int")
p.add_option('--startnumber', default=15, type="int")
p.add_option('--endnumber', default=100, type="int")

p.add_option('--config', '-c', 
            default="./dycast.config", 
            help="load config file FILE", 
            metavar="FILE"
            )

options, arguments = p.parse_args()

config_file = options.config

try:
    dycast.read_config(config_file)
except:
    print "could not read config file:", config_file
    sys.exit()

dycast.init_logging()

dycast.init_db()

if options.startnumber > options.endnumber:
  print "value for startnumber must be less than or equal to endnumber"
  sys.exit()

dycast.create_dist_margs(options.closespace, options.closetime, options.spatialdomain, options.temporaldomain, options.startnumber, options.endnumber)

dycast.calculate_probabilities()