Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
46ed29b
Add minor in yaxis at plotly module
neyberson Apr 22, 2024
34c4f9f
Add minor to yaxis1 at plotly module
neyberson Apr 22, 2024
2557bce
Merge branch 'main' of https://www.github.com/geopozo/pozo-py
neyberson Apr 23, 2024
39d597b
Delete note_list from graphs.py
neyberson Apr 24, 2024
6b458e9
Delete note_list from tracks.py
neyberson Apr 24, 2024
42958bf
Delete itertools at plotly.py from renderers
neyberson Apr 24, 2024
c6c8684
Change note_dict to notes at tracks.py
neyberson Apr 24, 2024
c0f55e1
Change note_dict to notes at graphs.py
neyberson Apr 24, 2024
89ef223
Change note_dict to notes at plotly.py
neyberson Apr 24, 2024
cd9635e
Add notes to __init__ at CrossPlot class
neyberson Apr 24, 2024
f88ec4c
Improve create_layout method at CrossPlot class
neyberson Apr 25, 2024
3017716
Change scope from _process_note method at Plotly to a function proces…
neyberson Apr 25, 2024
8ad7f28
Fixbug validations at create_layout from CrossPlot class
neyberson Apr 25, 2024
d09909d
Delete logic with posmap at create_layout method from CrossPlot class
neyberson Apr 25, 2024
e87de2c
Delete some parameters at create_layout method from CrossPlot class
neyberson Apr 25, 2024
f2b42ae
Add logic to identify pozo.Note at create_layout from CrossPlot class
neyberson Apr 26, 2024
0913a2e
Add logic to create trace and shape at create_layout from CrossPlot c…
neyberson Apr 26, 2024
c641a5f
Simplify the logic for some loops at create_layout from CrossPlot class
neyberson Apr 26, 2024
4c9ebfc
Fixbug for some shape and annotation extraction at create_layout from…
neyberson Apr 26, 2024
c113e25
Fixbug for some x0 and y0 extraction at create_layout from CrossPlot …
neyberson Apr 26, 2024
30f3577
Fixbug for some shape and annotation extraction at create_layout from…
neyberson Apr 26, 2024
4893b07
Delete loop at create_layout from CrossPlot class
neyberson Apr 26, 2024
66bc572
Fixbug conditionals at create_layout from CrossPlot class
neyberson Apr 26, 2024
24f260e
Improve the shape and annotation extraction at create_layout from Cro…
neyberson Apr 26, 2024
91bf71b
Format code the method create_layout from CrossPlot class
neyberson Apr 26, 2024
40e5ef8
Create PolygonNote class at annotations.py
neyberson Apr 29, 2024
a412e62
Create DepthNote class
neyberson Apr 29, 2024
70935ca
Delete some attributes from Note class
neyberson Apr 29, 2024
8e2b115
Improve DepthNote with validation at annotations.py
neyberson Apr 29, 2024
3a9a523
Improve DepthNote attributes at annotations.py
neyberson Apr 29, 2024
c484a78
Improve validations from DepthNote and PolygonNote at annotations.py
neyberson Apr 29, 2024
c52da33
Improve PolygonNote attributes at annotations.py
neyberson Apr 29, 2024
369e224
Delete some default values at DepthNote and PolygonNote at annotation…
neyberson Apr 29, 2024
a9eab43
Create LineNote class at annotations.py
neyberson Apr 29, 2024
2fe6791
Improve LineNote attributes at annotations.py
neyberson Apr 29, 2024
15dafdb
Add validation for LineNote at annotations.py
neyberson Apr 29, 2024
821a6f2
Delete Depth attribute for PolygonNote and LineNote at annotations.py
neyberson Apr 29, 2024
2c1815f
Add attributes to PolygonNote class at annotations.py
neyberson Apr 30, 2024
13c6d38
Format code at annotations.py
neyberson Apr 30, 2024
fb2493c
Change some attributes from PolygonNote to LineNote class at annotati…
neyberson Apr 30, 2024
122352d
Add attributes to PolygonNote class at annotations.py
neyberson Apr 30, 2024
fcc0f8c
Add multiple inheritance to LineNote class at annotations.py
neyberson Apr 30, 2024
68a2378
Update code with the new classes from annotations.py
neyberson Apr 30, 2024
13fb167
Improve conditionals from loop at create_layout method
neyberson Apr 30, 2024
87acbdc
Add comments to create_layout at plotly.py
neyberson Apr 30, 2024
f67d895
Add comments to some classes at annotations.py
neyberson Apr 30, 2024
f8a53a1
Convert NOte class to an abract class at annotations.py
neyberson May 2, 2024
ca2b920
Fix some bugs from DepthNote class at annotations.py
neyberson May 2, 2024
2ba79fa
Fixbug from opacity at Note class
neyberson May 2, 2024
c7dcf21
Improve the PolygoNote attributes with kwargs at annotations.py
neyberson May 2, 2024
61363cd
Improve the LineNote attributes with kwargs at annotations.py
neyberson May 2, 2024
4a54c6c
Change == for 'is' at LineNote class
neyberson May 2, 2024
208eae2
Delete some ',' at PolygonNote class
neyberson May 2, 2024
bc85076
Format code at annotations.py
neyberson May 2, 2024
346371e
Update __init__ to import DepthNote, PolygonNote and LineNote
neyberson May 2, 2024
7eeb0e0
Fix some issues with inheritance at annotations.py
neyberson May 2, 2024
48dfe2c
Improve inheritance and attributes at annotations.py
neyberson May 3, 2024
a1fc26e
Update create_layout method to extract attributes at CrossPlot class
neyberson May 3, 2024
c31b588
Add some attributes to the classes at annotations.py
neyberson May 3, 2024
880956f
Delete some useless default values at create_layout method from Cross…
neyberson May 3, 2024
06d4604
Format code at annotations.py
neyberson May 3, 2024
87a2d4c
Fix some bugs for extract axref, xref, ayref and yref for annotation …
neyberson May 6, 2024
e38e41c
Change the isinstance() logic for note classes at create_layout method
neyberson May 7, 2024
ab01e72
Change 'yref1' for 'yaxis1' at LineNote class
neyberson May 7, 2024
6994c01
Improve logic for annotations at create_layout()
neyberson May 7, 2024
5a54837
Add show_text attribute to the classes at annotations module
neyberson May 7, 2024
d0013bc
Merge branch 'main' of https://www.github.com/geopozo/pozo-py
neyberson May 8, 2024
b521814
Merge branch 'main' into fix-render
neyberson May 8, 2024
de7b91e
Create get_shape_annotation function into create_layout
neyberson May 8, 2024
fb19f6e
Delete self from get_shape_annotation
neyberson May 8, 2024
673fd34
Improve return at create_layout with get_shape_annotation
neyberson May 8, 2024
e9cfab3
Improve the return with fig_object at create_layout method
neyberson May 8, 2024
5e46475
Improve fig_object use at CrossPlot class
neyberson May 9, 2024
64b05a5
Improve the use from get_shape_annotation at create_layout method
neyberson May 9, 2024
592baf8
Delete get_shape_annotation function from create_layout method
neyberson May 9, 2024
932e7d7
Add fig_object to return at create_layout method
neyberson May 9, 2024
da84e39
Improve the logic for fig_object with focus on create_traces method
neyberson May 9, 2024
b25bfa8
Fixbug fig_object at create_layout method
neyberson May 9, 2024
69b11e6
Improve the logic to create traces about notes at create_traces method
neyberson May 10, 2024
f8b26b2
Improve loop for notes with notes variable and note_obj at creates_tr…
neyberson May 10, 2024
d64520c
Delete the strategy fig_object from CrossPlot class
neyberson May 10, 2024
f96c4c0
Lint code at CrossPlot class
neyberson May 10, 2024
b84ee3f
Add name to shape dictionary at create_traces method
neyberson May 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pozo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .axes import Axis # noqa
from .tracks import Track # noqa
from .graphs import Graph # noqa
from .annotations import Note # noqa
from .annotations import DepthNote, PolygonNote, LineNote # noqa

import pozo.themes as themes # noqa
import pozo.renderers as renderers # noqa
Expand Down
233 changes: 219 additions & 14 deletions pozo/annotations.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,227 @@
import pozo
import plotly.graph_objects as go
from abc import ABC

#TODO this doesn't handle units
#TODO xp doesn't handle units or check indices
#TODO what else doesn't handle units
class Note():
def __init__(self, depth, *, line={}, text="", width=1, fillcolor = 'lightskyblue', opacity=.5, show_text=True):
if not ( ( pozo.is_array(depth) and len(depth) == 2 ) or pozo.is_scalar_number(depth) ):
raise TypeError("depth must be two numbers in a tuple or list or just one number")

# TODO this doesn't handle units
# TODO xp doesn't handle units or check indices
# TODO what else doesn't handle units
class Note(ABC):
def __init__(
self,
*,
line={},
width=1,
fillcolor="lightskyblue",
opacity=0.5,
text="",
yshift=-5,
showarrow=False,
show_text=False
):
if not isinstance(line, dict):
raise TypeError("line must be a dictionary")
if width < -1 or width > 1:
raise ValueError("width must be between -1 and 1")
# TODO add further constraints on changes
self.depth = depth
self.line = line
self.fillcolor = fillcolor
self.opacity = None
self.show_text = True
self.text = text
self.width = width
self.line = line
self.fillcolor = fillcolor
self.opacity = opacity
self.width = width
self.text = text
self.yshift = yshift
self.showarrow = showarrow
self.show_text = show_text


class DepthNote(Note): # EN DESARROLLO
def __init__(
self,
depth,
*,
line={},
text="",
width=1,
fillcolor="lightskyblue",
opacity=0.5,
show_text=True,
yshift=-5,
showarrow=False,
):
super().__init__(
line=line,
width=width,
fillcolor=fillcolor,
opacity=opacity,
text=text,
yshift=yshift,
showarrow=showarrow,
)
if not (
(pozo.is_array(depth) and len(depth) == 2) or pozo.is_scalar_number(depth)
):
raise TypeError(
"depth must be two numbers in a tuple or list or just one number"
)
if not isinstance(line, dict):
raise TypeError("line must be a dictionary")
if width < -1 or width > 1:
raise ValueError("width must be between -1 and 1")
self.depth = depth
self.show_text = show_text
self.text = text


class PolygonNote(Note): # EN DESARROLLO
def __init__(
self,
x=[],
y=[],
xaxis="xaxis1",
yaxis="yaxis1",
fill="toself",
line={},
text="",
yshift=-5,
showarrow=False,
show_text=False,
**kwargs,
):
mode = kwargs.pop("mode", "lines")
width = kwargs.pop("width", 1)
fillcolor = kwargs.pop("fillcolor", "lightskyblue")
fillgradient = kwargs.pop("fillgradient", None)
fillpattern = kwargs.pop("fillpattern", None)
opacity = kwargs.pop("opacity", 0.5)
bgcolor = kwargs.pop("bgcolor", None)
bgcolorsrc = kwargs.pop("bgcolorsrc", None)
bordercolor = kwargs.pop("bordercolor", None)
bordercolorsrc = kwargs.pop("bordercolorsrc", None)
font = kwargs.pop("font", None)
groupnorm = kwargs.pop("groupnorm", None)
hoverinfo = kwargs.pop("hoverinfo", None)
hoverinfosrc = kwargs.pop("hoverinfosrc", None)
hoverlabel = kwargs.pop("hoverlabel", None)
hoveron = kwargs.pop("hoveron", None)
hovertemplate = kwargs.pop("hovertemplate", None)
hovertemplatesrc = kwargs.pop("hovertemplatesrc", None)
hovertext = kwargs.pop("hovertext", None)
hovertextsrc = kwargs.pop("hovertextsrc", None)
legend = kwargs.pop("legend", None)
legendgroup = kwargs.pop("legendgroup", None)
legendgrouptitle = kwargs.pop("legendgrouptitle", None)
legendrank = kwargs.pop("legendrank", None)
legendwidth = kwargs.pop("legendwidth", None)
ids = kwargs.pop("ids", None)

super().__init__(
line=line,
width=width,
fillcolor=fillcolor,
opacity=opacity,
text=text,
yshift=yshift,
showarrow=showarrow,
)
if not isinstance(line, dict):
raise TypeError("line must be a dictionary")
if width < -1 or width > 1:
raise ValueError("width must be between -1 and 1")
self.x = x
self.y = y
self.yaxis = xaxis
self.xaxis = yaxis
self.fill = fill
self.mode = mode
self.show_text = show_text
self.fillgradient = fillgradient
self.fillpattern = fillpattern
self.bgcolor = bgcolor
self.bgcolorsrc = bgcolorsrc
self.bordercolor = bordercolor
self.bordercolorsrc = bordercolorsrc
self.font = font
self.groupnorm = groupnorm
self.hoverinfo = hoverinfo
self.hoverinfosrc = hoverinfosrc
self.hoverlabel = hoverlabel
self.hoveron = hoveron
self.hovertemplate = hovertemplate
self.hovertemplatesrc = hovertemplatesrc
self.hovertext = hovertext
self.hovertextsrc = hovertextsrc
self.legend = legend
self.legendgroup = legendgroup
self.legendgrouptitle = legendgrouptitle
self.legendrank = legendrank
self.legendwidth = legendwidth
self.ids = ids


class LineNote(Note, go.Scatter): # EN DESARROLLO
def __init__(
self,
x0=0,
y0=0,
x1=None,
y1=None,
xref="xaxis1",
yref="yaxis1",
line={},
text="",
yshift=-5,
showarrow=False,
show_text=False,
**kwargs,
):
width = kwargs.pop("width", 1)
fillcolor = kwargs.pop("fillcolor", "lightskyblue")
opacity = kwargs.pop("opacity", 0.5)
hoverinfo = kwargs.pop("hoverinfo", None)
hoverinfosrc = kwargs.pop("hoverinfosrc", None)
hoverlabel = kwargs.pop("hoverlabel", None)
hovertemplate = kwargs.pop("hovertemplate", None)
hovertemplatesrc = kwargs.pop("hovertemplatesrc", None)
hovertext = kwargs.pop("hovertext", None)
hovertextsrc = kwargs.pop("hovertextsrc", None)
ids = kwargs.pop("ids", None)

if not isinstance(line, dict):
raise TypeError("line must be a dictionary")
if width < -1 or width > 1:
raise ValueError("width must be between -1 and 1")
if y1 is None or x1 is None:
raise ValueError("You must use values for x1 and y1")

Note.__init__(
self,
line=line,
width=width,
fillcolor=fillcolor,
opacity=opacity,
text=text,
yshift=yshift,
showarrow=showarrow,
show_text=show_text,
)
go.Scatter.__init__(
self,
x0=x0,
y0=y0,
x1=x1,
y1=y1,
xref=xref,
yref=yref,
line=line,
width=width,
fillcolor=fillcolor,
opacity=opacity,
hoverinfo=hoverinfo,
hoverinfosrc=hoverinfosrc,
hoverlabel=hoverlabel,
hovertemplate=hovertemplate,
hovertemplatesrc=hovertemplatesrc,
hovertext=hovertext,
hovertextsrc=hovertextsrc,
ids=ids,
)
3 changes: 1 addition & 2 deletions pozo/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def __init__(self, *args, **kwargs):
self.process_data(*args, **my_kwargs)
if len(args) == 1 and include and len(include) != 0:
self.reorder_all_tracks(include)
self.note_dict = {}
self.note_list = []
self.notes = {}

def summarize_curves(self, *selectors, **kwargs):
return self.renderer.summarize_curves(self, selectors=selectors, **kwargs)
Expand Down
Loading