예제 #1
0
파일: test.py 프로젝트: prusswan/redistrict
 def plot(self):
     state = State('RI',
                   '2015',
                   0,
                   0.5,
                   10,
                   0,
                   0.1,
                   cdist,
                   10,
                   unique_filename_for_state='RI_2017_10_07_14_17_05')
     state.plot()
     self.assertTrue(
         os.path.isfile(state.cong_dist_plot_dir + state.state +
                        '_cong_dist'))
     self.assertTrue(os.path.isfile(state.clusters_plot_filename + '.png'))
     self.assertTrue(os.path.isfile(state.clusters_plot_filename + '.pdf'))
예제 #2
0
# Create the State object, we want to cluster:
###############################################################################
state = State(args.state,
              year,
              alpha=alpha,
              alpha_increment=alpha_increment,
              alpha_max=alpha_max,
              beta=beta,
              beta_increment=beta_increment,
              dist=cdist,
              max_runs=max_runs,
              unique_filename_for_state=args.filename,
              verbose=args.verbose)

###############################################################################

##########################################################################
# Weighted k-means #######################################################
##########################################################################
state.cluster()

##########################################################################
# Statistics #############################################################
##########################################################################
state.run_stats()

##########################################################################
# Plotting ###############################################################
##########################################################################
state.plot()