diplotocus 0.5.0__tar.gz → 0.5.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {diplotocus-0.5.0 → diplotocus-0.5.1}/PKG-INFO +1 -1
  2. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/index.rst +1 -1
  3. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/GUI.ipynb +5 -0
  4. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/animations.ipynb +76 -0
  5. diplotocus-0.5.1/src/diplotocus/_version.py +1 -0
  6. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/animations.py +93 -1
  7. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus.egg-info/PKG-INFO +1 -1
  8. diplotocus-0.5.0/src/diplotocus/_version.py +0 -1
  9. {diplotocus-0.5.0 → diplotocus-0.5.1}/.gitattributes +0 -0
  10. {diplotocus-0.5.0 → diplotocus-0.5.1}/.gitignore +0 -0
  11. {diplotocus-0.5.0 → diplotocus-0.5.1}/.readthedocs.yaml +0 -0
  12. {diplotocus-0.5.0 → diplotocus-0.5.1}/LICENSE +0 -0
  13. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/Makefile +0 -0
  14. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/_static/force-light.css +0 -0
  15. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/_static/force-light.js +0 -0
  16. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/make.bat +0 -0
  17. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/requirements.txt +0 -0
  18. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/Web_GUI.png +0 -0
  19. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/button.svg +0 -0
  20. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/demo.mp4 +0 -0
  21. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/favicon.ico +0 -0
  22. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/force-light.css +0 -0
  23. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/force-light.js +0 -0
  24. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/logo.mp4 +0 -0
  25. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/_static/logo.svg +0 -0
  26. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/api/core.rst +0 -0
  27. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/api/index.rst +0 -0
  28. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/conf.py +0 -0
  29. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/easings.ipynb +0 -0
  30. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/index.ipynb +0 -0
  31. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/installation.ipynb +0 -0
  32. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/plot_objects.ipynb +0 -0
  33. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/quick-start.ipynb +0 -0
  34. {diplotocus-0.5.0 → diplotocus-0.5.1}/docs/source/notebooks/timeline.ipynb +0 -0
  35. {diplotocus-0.5.0 → diplotocus-0.5.1}/logo.png +0 -0
  36. {diplotocus-0.5.0 → diplotocus-0.5.1}/pyproject.toml +0 -0
  37. {diplotocus-0.5.0 → diplotocus-0.5.1}/readme.md +0 -0
  38. {diplotocus-0.5.0 → diplotocus-0.5.1}/setup.cfg +0 -0
  39. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/GUI.html +0 -0
  40. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/__init__.py +0 -0
  41. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/app.js +0 -0
  42. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/server.py +0 -0
  43. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/bg.png +0 -0
  44. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_Draw.png +0 -0
  45. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_Morph.png +0 -0
  46. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_Rotate.png +0 -0
  47. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_Scale.png +0 -0
  48. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_Sequence.png +0 -0
  49. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_Translate.png +0 -0
  50. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_Tween.png +0 -0
  51. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/btn/btn_bg_default.png +0 -0
  52. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/favicon.ico +0 -0
  53. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/src/logo_bg.png +0 -0
  54. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/GUI/style.css +0 -0
  55. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/__init__.py +0 -0
  56. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/core.py +0 -0
  57. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus/easings.py +0 -0
  58. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus.egg-info/SOURCES.txt +0 -0
  59. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus.egg-info/dependency_links.txt +0 -0
  60. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus.egg-info/requires.txt +0 -0
  61. {diplotocus-0.5.0 → diplotocus-0.5.1}/src/diplotocus.egg-info/top_level.txt +0 -0
  62. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test.py +0 -0
  63. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test10.py +0 -0
  64. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test2.py +0 -0
  65. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test3.py +0 -0
  66. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test4.py +0 -0
  67. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test5.py +0 -0
  68. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test6.py +0 -0
  69. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test7.py +0 -0
  70. {diplotocus-0.5.0 → diplotocus-0.5.1}/tests/test8.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diplotocus
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: A python package to generate animations of matplotlib objects.
5
5
  Author-email: Tristan Boin <tristan.boin@obspm.fr>
6
6
  License-Expression: MIT
@@ -45,7 +45,7 @@ Here's a quick example of the syntax of diplotocus:
45
45
  tl.animate(p)
46
46
 
47
47
  #We render our video
48
- tl.save_video(path='../_static/demo.mp4')
48
+ tl.save_video(path='demo.mp4')
49
49
 
50
50
  .. raw:: html
51
51
 
@@ -11,6 +11,11 @@
11
11
  "\n",
12
12
  "![](../_static/Web_GUI.png)\n",
13
13
  "\n",
14
+ "```{warning}\n",
15
+ "\n",
16
+ "The GUI might not be as stable as the python interface. Feel free to report any issues you encounters.\n",
17
+ "```\n",
18
+ "\n",
14
19
  "When running diplotocus through this mode, you will make edit your animation through a local web page in your browser. This page communicates with a python server, which links the GUI and diplotocus objects in the background. Hence, everything you can do through python, you can do through the GUI, and vice versa.\n",
15
20
  "\n",
16
21
  "```{note}\n",
@@ -817,6 +817,82 @@
817
817
  "tl.save_video('../_static/animations/axis_limits.mp4')"
818
818
  ]
819
819
  },
820
+ {
821
+ "cell_type": "markdown",
822
+ "id": "463d3df9",
823
+ "metadata": {},
824
+ "source": [
825
+ "### Axis pos and size\n",
826
+ "\n",
827
+ "```{eval-rst}\n",
828
+ ".. automethod:: diplotocus.animations.axis_pos_and_size\n",
829
+ " :noindex:\n",
830
+ "```"
831
+ ]
832
+ },
833
+ {
834
+ "cell_type": "code",
835
+ "execution_count": 4,
836
+ "id": "c01a5513",
837
+ "metadata": {},
838
+ "outputs": [
839
+ {
840
+ "data": {
841
+ "application/vnd.jupyter.widget-view+json": {
842
+ "model_id": "0c53fc7065614884aba3cfb420806912",
843
+ "version_major": 2,
844
+ "version_minor": 0
845
+ },
846
+ "text/plain": [
847
+ " 0%| | 0/60 [00:00<?, ?it/s]"
848
+ ]
849
+ },
850
+ "metadata": {},
851
+ "output_type": "display_data"
852
+ },
853
+ {
854
+ "data": {
855
+ "text/markdown": [
856
+ "Saved video ../_static/animations/axis_pos_and_size.mp4"
857
+ ],
858
+ "text/plain": [
859
+ "<IPython.core.display.Markdown object>"
860
+ ]
861
+ },
862
+ "metadata": {},
863
+ "output_type": "display_data"
864
+ },
865
+ {
866
+ "data": {
867
+ "text/html": [
868
+ "\n",
869
+ " <video width=\"640\" height=\"360\" autoplay loop muted playsinline>\n",
870
+ " <source src=\"../_static/animations/axis_pos_and_size.mp4?randId=4292\" type=\"video/mp4\">\n",
871
+ " </video>\n",
872
+ " "
873
+ ],
874
+ "text/plain": [
875
+ "<IPython.core.display.HTML object>"
876
+ ]
877
+ },
878
+ "metadata": {},
879
+ "output_type": "display_data"
880
+ }
881
+ ],
882
+ "source": [
883
+ "import diplotocus as dpl\n",
884
+ "import matplotlib.pyplot as plt\n",
885
+ "\n",
886
+ "fig,ax = plt.subplots(1,2)\n",
887
+ "\n",
888
+ "tl = dpl.Timeline(fig=fig)\n",
889
+ "\n",
890
+ "a = dpl.axis_pos_and_size(start_width=0.0,end_width=0.4,duration=60,axis=ax[1])\n",
891
+ "\n",
892
+ "tl.animate(a)\n",
893
+ "tl.save_video('../_static/animations/axis_pos_and_size.mp4')"
894
+ ]
895
+ },
820
896
  {
821
897
  "cell_type": "markdown",
822
898
  "id": "bc66aa88",
@@ -0,0 +1 @@
1
+ __version__ = "0.5.1"
@@ -789,7 +789,8 @@ class plotObject:
789
789
  self.x = anim['new_x']
790
790
  self.y = anim['new_y']
791
791
 
792
- if x >= self.x_min-1 and x < self.x_max-1 and self.obj is not None:
792
+ #if x >= self.x_min-1 and x < self.x_max-1 and self.obj is not None:
793
+ if self.obj is not None:
793
794
  if isinstance(self.obj,list):
794
795
  for obj in self.obj:
795
796
  try:
@@ -1005,6 +1006,95 @@ class axis_limits(plotObject):
1005
1006
  ylim_top = anim['start_ylim'][1] + (anim['ylim'][1] - anim['start_ylim'][1])*t
1006
1007
  self.axis.set_ylim(ylim_bottom,ylim_top)
1007
1008
 
1009
+ class axis_pos_and_size(plotObject):
1010
+ """
1011
+ Resize the axis to a given position and size.
1012
+
1013
+ Parameters
1014
+ ----------
1015
+ end_left : float
1016
+ Target left position
1017
+ end_bottom : float
1018
+ Target bottom position
1019
+ end_width : float
1020
+ Target width
1021
+ end_height : float
1022
+ Target height
1023
+ start_left = float
1024
+ Initial left position
1025
+ start_bottom : float
1026
+ Initial bottom position
1027
+ start_width : float
1028
+ Initial width
1029
+ start_height : float
1030
+ Initial height
1031
+ pos : array-like
1032
+ Target left and bottom position
1033
+ size : array-like
1034
+ Target width and height
1035
+ duration : float
1036
+ Duration of the animation
1037
+ delay : float, default=0
1038
+ Delay before starting
1039
+ easing : callable, optional
1040
+ Easing function
1041
+ axis : matplotlib.axes.Axes, optional
1042
+ Axis to plot on
1043
+ """
1044
+ def __init__(self,duration,
1045
+ end_left=None,end_bottom=None,end_width=None,end_height=None,
1046
+ start_left=None,start_bottom=None,start_width=None,start_height=None,
1047
+ delay=0,easing=None,axis=None,*args,**kwargs):
1048
+ super().__init__(axis=axis,*args, **kwargs)
1049
+ self.anims = [{
1050
+ 'name':'axis_move',
1051
+ 'duration':duration,
1052
+ 'delay':delay,
1053
+ 'easing':easing,
1054
+ 'persistent':True,
1055
+ 'start':[start_left,start_bottom,start_width,start_height],
1056
+ 'end':[end_left,end_bottom,end_width,end_height],
1057
+ 'played':False
1058
+ }]
1059
+ self.compute_timings()
1060
+
1061
+ def init(self):
1062
+ left_i = self.axis.get_position().x0
1063
+ bottom_i = self.axis.get_position().y0
1064
+ width_i = self.axis.get_position().width
1065
+ height_i = self.axis.get_position().height
1066
+ if self.anims[0]['start'][0] is None:
1067
+ self.anims[0]['start'][0] = left_i
1068
+ if self.anims[0]['start'][1] is None:
1069
+ self.anims[0]['start'][1] = bottom_i
1070
+ if self.anims[0]['start'][2] is None:
1071
+ self.anims[0]['start'][2] = width_i
1072
+ if self.anims[0]['start'][3] is None:
1073
+ self.anims[0]['start'][3] = height_i
1074
+ if self.anims[0]['end'][0] is None:
1075
+ self.anims[0]['end'][0] = left_i
1076
+ if self.anims[0]['end'][1] is None:
1077
+ self.anims[0]['end'][1] = bottom_i
1078
+ if self.anims[0]['end'][2] is None:
1079
+ self.anims[0]['end'][2] = width_i
1080
+ if self.anims[0]['end'][3] is None:
1081
+ self.anims[0]['end'][3] = height_i
1082
+
1083
+ def function(self,data_x,data_y,x,kwargs):
1084
+ anim = self.anims[0]
1085
+ if x < anim['delay']:
1086
+ return
1087
+ _x = min(x,anim['duration'] + anim['delay']-1)
1088
+ t = self.get_t_from_x(anim,x)
1089
+ width = self.axis.get_xlim()[1]-self.axis.get_xlim()[0]
1090
+ height = self.axis.get_ylim()[1]-self.axis.get_ylim()[0]
1091
+ pos_x = anim['start'][0] + (anim['end'][0] - anim['start'][0])*t
1092
+ pos_y = anim['start'][1] + (anim['end'][1] - anim['start'][1])*t
1093
+ width = anim['start'][2] + (anim['end'][2] - anim['start'][2])*t
1094
+ height = anim['start'][3] + (anim['end'][3] - anim['start'][3])*t
1095
+ self.axis.set_position((pos_x,pos_y,width,height))
1096
+
1097
+
1008
1098
  class axis_move(plotObject):
1009
1099
  """
1010
1100
  Move the center of the axis to a given position.
@@ -2113,6 +2203,7 @@ class fill_between(plotObject):
2113
2203
  self.mpl_plot_type = plt.fill_between
2114
2204
  y1 = to_np_array(y1).reshape(-1)
2115
2205
  y2 = to_np_array(y2).reshape(-1)
2206
+ x = to_np_array(x)
2116
2207
  if y1.size != x.size:
2117
2208
  y1 = np.ones_like(x)*y1[0]
2118
2209
  if y2.size != x.size:
@@ -2308,6 +2399,7 @@ class fill_betweenx(plotObject):
2308
2399
  self.mpl_plot_type = plt.fill_betweenx
2309
2400
  x1 = to_np_array(x1).reshape(-1)
2310
2401
  x2 = to_np_array(x2).reshape(-1)
2402
+ y = to_np_array(y)
2311
2403
  if x1.size != y.size:
2312
2404
  x1 = np.ones_like(y)*x1[0]
2313
2405
  if x2.size != y.size:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: diplotocus
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: A python package to generate animations of matplotlib objects.
5
5
  Author-email: Tristan Boin <tristan.boin@obspm.fr>
6
6
  License-Expression: MIT
@@ -1 +0,0 @@
1
- __version__ = "0.5.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes