From c303496f54035f1397caf778b5c9f0e996b17999 Mon Sep 17 00:00:00 2001
From: rugeli <91452427+rugeli@users.noreply.github.com>
Date: Tue, 11 Jun 2024 19:06:00 +0000
Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20main=20@=20a?=
=?UTF-8?q?cea1ee14c728066864ab415559107910d168cc4=20=F0=9F=9A=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
_modules/cellpack/autopack/Analysis.html | 87 +++++++-----
_modules/cellpack/autopack/Environment.html | 7 +-
.../autopack/upy/simularium/plots.html | 131 ++++++++++++++++++
.../upy/simularium/simularium_helper.html | 8 +-
_modules/cellpack/autopack/writers.html | 2 +
_modules/index.html | 1 +
.../cellpack.autopack.upy.simularium.rst.txt | 8 ++
cellpack.autopack.html | 3 +-
cellpack.autopack.upy.html | 8 ++
cellpack.autopack.upy.simularium.html | 27 ++++
genindex.html | 19 ++-
objects.inv | Bin 11649 -> 11688 bytes
py-modindex.html | 5 +
searchindex.js | 2 +-
14 files changed, 268 insertions(+), 40 deletions(-)
create mode 100644 _modules/cellpack/autopack/upy/simularium/plots.html
diff --git a/_modules/cellpack/autopack/Analysis.html b/_modules/cellpack/autopack/Analysis.html
index f9a94a169..5be6ce990 100644
--- a/_modules/cellpack/autopack/Analysis.html
+++ b/_modules/cellpack/autopack/Analysis.html
@@ -96,6 +96,7 @@
self . figures_path = self . output_path / "figures"
self . figures_path . mkdir ( parents = True , exist_ok = True )
self . seed_to_results = {}
+ self . helper = autopack . helper
[docs]
@@ -218,6 +219,7 @@
Source code for cellpack.autopack.Analysis
title_str = ingr_key ,
x_label = "pairwise distance" ,
y_label = "count" ,
+ save_png = True ,
)
@@ -690,33 +692,53 @@
Source code for cellpack.autopack.Analysis
[docs]
-
def histogram ( self , distances , filename , title_str = "" , x_label = "" , y_label = "" ):
-
plt . clf ()
-
# calculate histogram
-
nbins = int ( numpy . sqrt ( len ( distances )))
-
if nbins < 2 :
-
return
-
y , bin_edges = numpy . histogram ( distances , bins = nbins )
-
bincenters = 0.5 * ( bin_edges [ 1 :] + bin_edges [: - 1 ])
-
-
# calculate standard error for values in each bin
-
bin_inds = numpy . digitize ( distances , bin_edges )
-
x_err_vals = numpy . zeros ( y . shape )
-
for bc in range ( nbins ):
-
dist_vals = distances [ bin_inds == ( bc + 1 )]
-
if len ( dist_vals ) > 1 :
-
x_err_vals [ bc ] = numpy . std ( dist_vals )
-
else :
-
x_err_vals [ bc ] = 0
-
y_err_vals = numpy . sqrt ( y * ( 1 - y / numpy . sum ( y )))
-
# set bin width
-
dbin = 0.9 * ( bincenters [ 1 ] - bincenters [ 0 ])
-
plt . bar ( bincenters , y , width = dbin , color = "r" , xerr = x_err_vals , yerr = y_err_vals )
-
plt . title ( title_str )
-
plt . xlabel ( x_label )
-
plt . ylabel ( y_label )
-
plt . savefig ( filename )
-
plt . close ()
+ def histogram (
+ self ,
+ distances ,
+ filename ,
+ title_str = "" ,
+ x_label = "" ,
+ y_label = "" ,
+ add_to_result = True ,
+ save_png = False ,
+ ):
+ if add_to_result :
+ # add histogrm to result file and display on the web page
+ self . helper . plot_data . add_histogram (
+ title = f " { title_str } : { x_label } " ,
+ xaxis_title = x_label ,
+ traces = { y_label : numpy . array ( distances )},
+ )
+ if save_png :
+ # use matplotlib to create histogram and save as png
+ plt . clf ()
+ # calculate histogram
+ nbins = int ( numpy . sqrt ( len ( distances )))
+ if nbins < 2 :
+ return
+ y , bin_edges = numpy . histogram ( distances , bins = nbins )
+ bincenters = 0.5 * ( bin_edges [ 1 :] + bin_edges [: - 1 ])
+
+ # calculate standard error for values in each bin
+ bin_inds = numpy . digitize ( distances , bin_edges )
+ x_err_vals = numpy . zeros ( y . shape )
+ for bc in range ( nbins ):
+ dist_vals = distances [ bin_inds == ( bc + 1 )]
+ if len ( dist_vals ) > 1 :
+ x_err_vals [ bc ] = numpy . std ( dist_vals )
+ else :
+ x_err_vals [ bc ] = 0
+ y_err_vals = numpy . sqrt ( y * ( 1 - y / numpy . sum ( y )))
+ # set bin width
+ dbin = 0.9 * ( bincenters [ 1 ] - bincenters [ 0 ])
+ plt . bar (
+ bincenters , y , width = dbin , color = "r" , xerr = x_err_vals , yerr = y_err_vals
+ )
+ plt . title ( title_str )
+ plt . xlabel ( x_label )
+ plt . ylabel ( y_label )
+ plt . savefig ( filename )
+ plt . close ()
@@ -1122,7 +1144,6 @@
Source code for cellpack.autopack.Analysis
seed = int ( seed_list [ seed_index ])
seed_basename = self . env . add_seed_number_to_base_name ( seed )
self . env . reset ()
- self . env . saveResult = True
numpy . random . seed ( seed )
self . build_grid ()
two_d = self . env . is_two_d ()
@@ -1266,7 +1287,6 @@ Source code for cellpack.autopack.Analysis
)
grid_image_writer = gradient . create_voxelization ( grid_image_writer )
grid_image_writer . export_image ()
-
return (
center_distance_dict ,
pairwise_distance_dict ,
@@ -1437,9 +1457,6 @@ Source code for cellpack.autopack.Analysis
self . writeJSON ( ingredient_occurences_file , ingredient_occurence_dict )
self . writeJSON ( ingredient_key_file , ingredient_key_dict )
- if number_of_packings > 1 :
- Writer () . save_as_simularium ( self . env , self . seed_to_results )
-
all_ingredient_positions = self . combine_results_from_seeds (
ingredient_position_dict
)
@@ -1531,7 +1548,11 @@ Source code for cellpack.autopack.Analysis
title_str = "all_ingredients" ,
x_label = "angles Z" ,
y_label = "count" ,
- )
+ )
+ if number_of_packings > 1 :
+ for seed , result in self . seed_to_results . items ():
+ Writer () . save_as_simularium ( self . env , { seed : result })
+ Writer () . save_as_simularium ( self . env , self . seed_to_results )
diff --git a/_modules/cellpack/autopack/Environment.html b/_modules/cellpack/autopack/Environment.html
index fda53e129..740df9a15 100644
--- a/_modules/cellpack/autopack/Environment.html
+++ b/_modules/cellpack/autopack/Environment.html
@@ -185,7 +185,11 @@
Source code for cellpack.autopack.Environment self. name = name
self . version = recipe . get ( "version" , "default" )
# saving/pickle option
- self . saveResult = "out" in config
+ self . saveResult = (
+ "out" in config
+ and not config [ "save_analyze_result" ]
+ and not config [ "number_of_packings" ] > 1
+ )
self . out_folder = create_output_dir ( config [ "out" ], name , config [ "place_method" ])
self . base_name = f " { self . name } _ { config [ 'name' ] } _ { self . version } "
self . grid_file_out = (
@@ -2422,7 +2426,6 @@ Source code for cellpack.autopack.Environment pbar. close ()
self . log . info ( "time to fill %d " , t2 - t1 )
all_objects = self . prep_molecules_for_save ( distances , free_points , nbFreePoints )
-
if self . saveResult :
self . save_result (
free_points ,
diff --git a/_modules/cellpack/autopack/upy/simularium/plots.html b/_modules/cellpack/autopack/upy/simularium/plots.html
new file mode 100644
index 000000000..ae21296ab
--- /dev/null
+++ b/_modules/cellpack/autopack/upy/simularium/plots.html
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+ cellpack.autopack.upy.simularium.plots — cellPack 1.0.8 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for cellpack.autopack.upy.simularium.plots
+import numpy as np
+from simulariumio import ScatterPlotData , HistogramPlotData
+
+
+
+
[docs]
+
class PlotData :
+
def __init__ ( self ):
+
self . plot_list = [] # list of tuples
+
+
def _add_plot ( self , plot ):
+
self . plot_list . append ( plot )
+
+
+
[docs]
+
def add_scatter ( self , title , xaxis_title , yaxis_title , xtrace , ytraces ):
+
self . _add_plot (
+
(
+
"scatter" ,
+
ScatterPlotData (
+
title = title ,
+
xaxis_title = xaxis_title ,
+
yaxis_title = yaxis_title ,
+
xtrace = np . array ( xtrace ),
+
ytraces = { key : np . array ( value ) for key , value in ytraces . items ()},
+
),
+
)
+
)
+
+
+
+
[docs]
+
def add_histogram ( self , title , xaxis_title , traces ):
+
self . _add_plot (
+
(
+
"histogram" ,
+
HistogramPlotData (
+
title = title ,
+
xaxis_title = xaxis_title ,
+
traces = { key : np . array ( value ) for key , value in traces . items ()},
+
),
+
)
+
)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/_modules/cellpack/autopack/upy/simularium/simularium_helper.html b/_modules/cellpack/autopack/upy/simularium/simularium_helper.html
index 00e15ebfd..a638cadf5 100644
--- a/_modules/cellpack/autopack/upy/simularium/simularium_helper.html
+++ b/_modules/cellpack/autopack/upy/simularium/simularium_helper.html
@@ -63,6 +63,7 @@ Source code for cellpack.autopack.upy.simularium.simularium_helper from
simulariumio.constants import DISPLAY_TYPE , VIZ_TYPE
from cellpack.autopack.upy import hostHelper
+
from cellpack.autopack.upy.simularium.plots import PlotData
from cellpack.autopack.DBRecipeHandler import DBUploader , DBMaintenance
from cellpack.autopack.interface_objects.database_ids import DATABASE_IDS
import collada
@@ -167,6 +168,7 @@
Source code for cellpack.autopack.upy.simularium.simularium_helper self
. nogui = True
self . hext = "dae"
self . max_fiber_length = 0
+
self . plot_data = PlotData ()