Skip to content

Commit 0c449be

Browse files
authored
Merge pull request #33 from elmbeech/master
release v4.0.2
2 parents 3a1d9b3 + bbafc80 commit 0c449be

File tree

7 files changed

+37
-30
lines changed

7 files changed

+37
-30
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ Developers, please make pull requests to the https://github.com/elmbeech/physice
125125
+ evt generate lineage tree graph output files.
126126

127127
## Release Notes:
128+
+ version 4.0.2 (2025-06-29): elmbeech/physicelldataloader
129+
+ minor bugfixes.
130+
128131
+ version 4.0.1 (2025-06-24): elmbeech/physicelldataloader
129132
+ man updated.
130133
+ minor bugfixes.

man/TUTORIAL_commandline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The command parameter mimics the related python3 function arguments as closely a
99
You can always call the [help](https://en.wikipedia.org/wiki/Help!) parameter ( pcdl\_command -h),
1010
to access the man page for a pcdl command!
1111

12-
Please spend some time to learn about each of the 18 commands, by studying its man page.
12+
Please spend some time to learn about each of the about 20 commands, by studying its man page.
1313
This will truly make you a power user!
1414

1515

man/TUTORIAL_python3_vtk.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
[Vtk](https://vtk.org/) the visualization tool kit is a software for image processing, 3D graphics, volume rendering and visualization. \
44
Naturally, we will work here with the [vtk](https://pypi.org/project/vtk/) python binding.
5-
Additionally, we will have a look at [fury](https://fury.gl/latest/index.html),
6-
a python library for scientific visualization and 3D animations that can read vtk files too.
5+
Additionally, we will have a look at the [pyvista](https://docs.pyvista.org/) and [fury](https://fury.gl/latest/index.html) python libraries for scientific visualization that can read vtk files too.
76

87

98

pcdl/VERSION.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '4.0.1'
1+
__version__ = '4.0.2'

pcdl/commandline.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ def get_conc_attribute():
338338
keep = set(args.keep),
339339
allvalues = b_allvalues,
340340
)
341-
s_opathfile = f'{s_path}/timeseries_conc_attribute_{s_values}.json'
341+
s_ofile = f"timeseries_conc_attribute_{s_values.replace(' ','_')}.json"
342+
s_opathfile = s_path + '/' + s_ofile
342343
json.dump(dl_variable, open(s_opathfile, 'w'), sort_keys=True)
343344
# going home
344345
return s_opathfile
@@ -1038,7 +1039,7 @@ def get_cell_attribute():
10381039
b_allvalues = True if args.allvalues.lower().startswith('t') else False
10391040
if b_allvalues:
10401041
s_values = 'all'
1041-
s_opathfile = f"{s_pathfile.replace('.xml','')}_{s_values}.json"
1042+
s_opathfile = f"{s_pathfile.replace('.xml','')}_{s_values.replace(' ','_')}.json"
10421043

10431044
else:
10441045
mcdsts = pcdl.TimeSeries(
@@ -1056,7 +1057,8 @@ def get_cell_attribute():
10561057
b_allvalues = True if args.allvalues.lower().startswith('t') else False
10571058
if b_allvalues:
10581059
s_values = 'all'
1059-
s_opathfile = f'{s_path}/timeseries_cell_attribute_{s_values}.json'
1060+
s_ofile = f"timeseries_cell_attribute_{s_values.replace(' ','_')}.json"
1061+
s_opathfile = s_path + '/' + s_ofile
10601062

10611063
# going home
10621064
dl_variable = mcdsts.get_cell_attribute(
@@ -1375,11 +1377,10 @@ def get_anndata():
13751377
# going home
13761378
if b_collapse :
13771379
s_opathfile = f'{s_path}/timeseries_cell_{args.scale}.h5ad'
1378-
s_opathfile = f'{s_path}/timeseries_cell_{args.scale.lower()}.h5ad'
13791380
ann_mcdsts.write_h5ad(s_opathfile)
13801381
return s_opathfile
13811382
else:
1382-
ls_opathfile = [f"{s_path}/{s_xmlfile.replace('.xml', '_cell_{}.h5ad'.format(args.scale.lower()))}" for s_xmlfile in mcdsts.get_xmlfile_list()]
1383+
ls_opathfile = [f"{s_path}/{s_xmlfile.replace('.xml', '_cell_{}.h5ad'.format(args.scale))}" for s_xmlfile in mcdsts.get_xmlfile_list()]
13831384
for i, ann_mcds in enumerate(ann_mcdsts):
13841385
ann_mcds.write_h5ad(ls_opathfile[i])
13851386
return ls_opathfile
@@ -1765,8 +1766,8 @@ def plot_scatter():
17651766
figbgcolor = None if (args.figbgcolor.lower() == 'none') else args.figbgcolor,
17661767
)
17671768
# going home
1768-
s_opathfile = '/'.join(ls_opathfile[0].split('/')[:-1])
1769-
return s_opathfile
1769+
s_opath = '/'.join(ls_opathfile[0].split('/')[:-1])
1770+
return s_opath
17701771

17711772

17721773
def make_cell_vtk():

pcdl/timeseries.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ def make_gif(path, interface='jpeg'):
8080
if path.endswith('/'): path = path[:-1]
8181
if not os.path.isdir(path):
8282
sys.exit(f'Error @ make_gif : {path} path does not exist.')
83-
s_file = path.split('/')[-1]
84-
if s_file.startswith('.'): s_file = s_file[1:]
85-
if (len(s_file) == 0): s_file = 'movie'
86-
s_file += f'_{interface}.gif'
87-
s_opathfile = f'{path}/{s_file}'
83+
s_ofile = path.split('/')[-1]
84+
if s_ofile.startswith('.'): s_ofile = s_ofile[1:]
85+
if (len(s_ofile) == 0): s_ofile = 'movie'
86+
s_ofile += f'_{interface}.gif'
87+
s_ofile = s_ofile.replace(' ','_')
88+
s_opathfile = path + '/' + s_ofile
8889
s_ipathfiles = f'{path}/*.{interface}'
8990
# genaerate gif
90-
s_cmd = f'{s_magick}convert {s_ipathfiles} {s_opathfile}'
91+
s_cmd = f'{s_magick}convert "{s_ipathfiles}" "{s_opathfile}"'
9192
if (os.system(s_cmd) != 0):
9293
sys.exit("Error @ make_gif : imagemagick could not generatet the gif.")
9394

@@ -133,6 +134,7 @@ def make_movie(path, interface='jpeg', framerate=12):
133134
if s_ofile.startswith('.'): s_ofile = s_ofile[1:]
134135
if (len(s_ofile) == 0): s_ofile = 'movie'
135136
s_ofile += f'_{interface}{framerate}.mp4'
137+
s_ofile = s_ofile.replace(' ','_')
136138
s_opathfile = f'{s_path}/{s_ofile}'
137139

138140
# generate input file list
@@ -144,7 +146,7 @@ def make_movie(path, interface='jpeg', framerate=12):
144146
f.close()
145147

146148
# genearete movie
147-
s_cmd = f'ffmpeg -y -r {framerate} -f concat -i ffmpeginput.txt -vcodec libx264 -pix_fmt yuv420p -strict -2 -tune animation -crf 15 -acodec none {s_ofile}' # -safe 0
149+
s_cmd = f'ffmpeg -y -r {framerate} -f concat -i ffmpeginput.txt -vcodec libx264 -pix_fmt yuv420p -strict -2 -tune animation -crf 15 -acodec none "{s_ofile}"' # -safe 0
148150
if (os.system(s_cmd) != 0):
149151
sys.exit("Error @ make_movie : ffmpeg could not generatet the movie.")
150152
os.remove('ffmpeginput.txt')
@@ -1100,7 +1102,7 @@ def make_ome_tiff(self, cell_attribute='ID', conc_cutoff={}, focus=None, file=Tr
11001102
s_channel += f'_{s_celltype}'
11011103
if len(ls_celltype) > 0:
11021104
s_channel += f'_{cell_attribute}'
1103-
s_tifffile = f'timeseries{s_channel}.ome.tiff'
1105+
s_tifffile = f"timeseries{s_channel.replace(' ','_')}.ome.tiff"
11041106
if (len(s_tifffile) > 255):
11051107
print(f"Warning: filename {len(s_tifffile)} > 255 character.")
11061108
s_tifffile = 'timeseries_channels.ome.tiff'
@@ -1396,9 +1398,10 @@ def plot_timeseries(self, focus_cat=None, focus_num=None, aggregate_num=np.nanme
13961398
return fig
13971399
else:
13981400
if (focus_num == 'count'):
1399-
s_pathfile = self.path + f'/timeseries_{frame}_{focus_cat}_{focus_num}.{ext}'
1401+
s_ofile = 'timeseries_{frame}_{focus_cat}_{focus_num}.{ext}'.replace(' ','_')
14001402
else:
1401-
s_pathfile = self.path + f"/timeseries_{frame}_{focus_cat}_{focus_num}_{aggregate_num.__name__.replace('np.nan','')}.{ext}"
1403+
s_ofile = f"timeseries_{frame}_{focus_cat}_{focus_num}_{aggregate_num.__name__.replace('np.nan','')}.{ext}".replace(' ','_')
1404+
s_pathfile = self.path + '/' + s_ofile
14021405
if figbgcolor is None:
14031406
figbgcolor = 'auto'
14041407
plt.tight_layout()

pcdl/timestep.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,9 +1300,9 @@ def plot_contour(self, focus, z_slice=0.0, vmin=None, vmax=None, alpha=1, fill=T
13001300

13011301
else:
13021302
# handle output path and filename
1303-
s_path = self.path + f'/conc_{focus}_z{round(z_slice,9)}/'
1303+
s_path = self.path + f"/conc_{focus.replace(' ','_')}_z{round(z_slice,9)}/"
13041304
os.makedirs(s_path, exist_ok=True)
1305-
s_file = self.xmlfile.replace('.xml', f'_{focus}.{ext}')
1305+
s_file = self.xmlfile.replace('.xml', f"_{focus.replace(' ','_')}.{ext}")
13061306
s_pathfile = f'{s_path}{s_file}'
13071307
# handle figure background color
13081308
if figbgcolor is None:
@@ -1755,9 +1755,9 @@ def plot_scatter(self, focus='cell_type', z_slice=0.0, z_axis=None, alpha=1, cma
17551755

17561756
else:
17571757
# handle output path and filename
1758-
s_path = self.path + f'/cell_{focus}_z{round(z_slice,9)}/'
1758+
s_path = self.path + f"/cell_{focus.replace(' ','_')}_z{round(z_slice,9)}/"
17591759
os.makedirs(s_path, exist_ok=True)
1760-
s_file = self.xmlfile.replace('.xml', f'_{focus}.{ext}')
1760+
s_file = self.xmlfile.replace('.xml', f"_{focus.replace(' ','_')}.{ext}")
17611761
s_pathfile = f'{s_path}{s_file}'
17621762
# handle figure background color
17631763
if figbgcolor is None:
@@ -2087,6 +2087,7 @@ def make_ome_tiff(self, cell_attribute='ID', conc_cutoff={}, focus=None, file=Tr
20872087
if len(ls_celltype) > 0:
20882088
s_channel += f'_{cell_attribute}'
20892089
s_tifffile = self.xmlfile.replace('.xml', f'{s_channel}.ome.tiff')
2090+
s_tifffile = s_tifffile.replace(' ','_')
20902091
if (len(s_tifffile) > 255):
20912092
print(f"Warning: filename {len(s_tifffile)} > 255 character.")
20922093
s_tifffile = self.xmlfile.replace('.xml', f'_channels.ome.tiff')
@@ -2398,7 +2399,7 @@ def _read_xml(self, xmlfile, output_path='.'):
23982399
# <cell_definition>
23992400
s_id = str(x_celltype.get('ID'))
24002401
# I don't like spaces in cell type names!
2401-
s_celltype = x_celltype.get('name') #.replace(' ', '_') # ROH
2402+
s_celltype = x_celltype.get('name') #.replace(' ','_') # ROH
24022403
d_mcds['cell']['ds_celltype'].update({s_id : s_celltype})
24032404
b_celltype = True
24042405

@@ -2575,7 +2576,7 @@ def _read_xml(self, xmlfile, output_path='.'):
25752576
# substrate loop
25762577
for i_s, x_substrate in enumerate(x_microenv.find('variables').findall('variable')):
25772578
# i don't like spaces in species names!
2578-
s_substrate = x_substrate.get('name') #.replace(' ', '_') # ROH
2579+
s_substrate = x_substrate.get('name') #.replace(' ','_') # ROH
25792580

25802581
d_mcds['raw_substrate'][s_substrate] = {}
25812582
d_mcds['raw_substrate'][s_substrate]['units'] = x_substrate.get('units')
@@ -2693,7 +2694,7 @@ def _read_xml(self, xmlfile, output_path='.'):
26932694
for x_celltype in x_celldata.find('cell_types').findall('type'):
26942695
s_id = str(x_celltype.get('ID'))
26952696
# I don't like spaces in cell type names!
2696-
s_celltype = x_celltype.text #.replace(' ', '_') # ROH
2697+
s_celltype = x_celltype.text #.replace(' ','_') # ROH
26972698
d_mcds['cell']['ds_celltype'].update({s_id : s_celltype})
26982699
b_celltype = True
26992700
except AttributeError:
@@ -2703,7 +2704,7 @@ def _read_xml(self, xmlfile, output_path='.'):
27032704
if not b_celltype:
27042705
for x_label in x_celldata.find('labels').findall('label'):
27052706
# I don't like spaces in cell type names!
2706-
s_variable = x_label.tex #.replace(' ', '_') # ROH
2707+
s_variable = x_label.tex #.replace(' ','_') # ROH
27072708
if s_variable in es_var_cell:
27082709
for i_id in range(int(x_label.get('size'))):
27092710
s_id = str(i_id)
@@ -2714,7 +2715,7 @@ def _read_xml(self, xmlfile, output_path='.'):
27142715
ls_variable = []
27152716
for x_label in x_celldata.find('labels').findall('label'):
27162717
# I don't like spaces in my dictionary keys!
2717-
s_variable = x_label.text #.replace(' ', '_') # ROH
2718+
s_variable = x_label.text #.replace(' ','_') # ROH
27182719
i_variable = int(x_label.get('size'))
27192720
s_unit = x_label.get('units')
27202721

0 commit comments

Comments
 (0)