Commit Graph

2246 Commits (78defa00ec02a7b2701f85d8f60c9843829acc4b)

Author SHA1 Message Date
Tyler Goodlet 78defa00ec Drop old non-working flatten routine 2022-05-15 17:06:52 -04:00
Tyler Goodlet 3cb6b7221c Factor step format data gen into `to_step_format()`
Yet another path ops routine which converts a 1d array into a data
format suitable for rendering a "step curve" graphics path (aka a "bar
graph" but implemented as a continuous line).

Also, factor the `BarItems` rendering logic (which determines whether to
render the literal bars lines or a downsampled curve) into a routine
`render_baritems()` until we figure out the right abstraction layer for
it.
2022-05-15 16:54:50 -04:00
Tyler Goodlet 06d3cadcc0 Factor ohlc to line data conversion into `._pathops.ohlc_to_line()` 2022-05-15 15:45:06 -04:00
Tyler Goodlet fdd4255246 Drop commented `numba` imports 2022-05-15 15:44:19 -04:00
Tyler Goodlet e9c244ccd0 Move ohlc lines-curve generators into pathops mod 2022-05-15 15:21:25 -04:00
Tyler Goodlet ce68e612de Add `.ui._pathops` module
Starts a module for grouping together all our `QPainterpath` related
generation and data format operations for creation of fast curve
graphics. To start, drops `FastAppendCurve.downsample()` and moves
it to a new `._pathops.xy_downsample()`.
2022-05-15 15:15:14 -04:00
Tyler Goodlet 3bf907c10f Rename `._ohlc.gen_qpath()` -> `.gen_ohlc_qpath()` 2022-05-15 14:30:13 -04:00
Tyler Goodlet b7f7296f3a Drop `BarItems.update_from_array()`; moved into `Flow` 2022-05-15 14:29:03 -04:00
Tyler Goodlet e3dd933b34 Drop legacy step mode data formatter 2022-05-15 14:12:09 -04:00
Tyler Goodlet f93ac15440 Always delay interaction update profiling 2022-05-15 14:07:13 -04:00
Tyler Goodlet 54ae86544a Add "no-tsdb-found" history load length defaults 2022-05-15 14:07:13 -04:00
Tyler Goodlet 7555cb4318 Use `ms_threshold` throughout remaining profilers 2022-05-15 14:07:13 -04:00
Tyler Goodlet b83ec0fad6 Use new flag, add more marks through display loop 2022-05-15 14:07:13 -04:00
Tyler Goodlet a8fa034b61 Use new profiler arg name, add more marks throughout flow update 2022-05-15 14:07:13 -04:00
Tyler Goodlet 60ef3ba258 Drop legacy step path gen, always slice full data
Mostly just dropping old commented code for "step mode" format
generation. Always slice the tail part of the input data and move to the
new `ms_threshold` in the `pg` profiler'
2022-05-15 14:07:13 -04:00
Tyler Goodlet e1e42e4208 Error log brokerd msgs that have `.reqid == None`
Relates to the bug discovered in #310, this should avoid out-of-order
msgs which do not have a `.reqid` set to be error logged to console.
Further, add `pformat()` to kraken logging of ems msging.
2022-05-15 14:07:13 -04:00
Tyler Goodlet af61eac389 Only udpate prepended graphics when actually in view 2022-05-15 14:07:13 -04:00
Tyler Goodlet aafb506384 Add back mx/mn updates for L1-in-view, lost during rebase 2022-05-15 14:07:13 -04:00
Tyler Goodlet 8fec88236f Clean out legacy code from `Flow.update_graphics()` 2022-05-15 14:07:13 -04:00
Tyler Goodlet 083e6205e2 Drop `bar_wap` curve for now, seems to also be causing hangs?! 2022-05-15 14:07:13 -04:00
Tyler Goodlet f560ba396b Add profiler passthrough type annot, comments about appends vs. uppx 2022-05-15 14:07:13 -04:00
Tyler Goodlet 588f7fb7c3 An absolute uppx diff of >= 1 seems more then fine 2022-05-15 14:07:13 -04:00
Tyler Goodlet f01dd72dc2 Up the display throttle rate to 22Hz 2022-05-15 14:07:13 -04:00
Tyler Goodlet 948d12cce9 Only do curve appends on low uppx levels 2022-05-15 14:07:13 -04:00
Tyler Goodlet 2568c634bd Startup up with 3k bars 2022-05-15 14:07:13 -04:00
Tyler Goodlet a2b35c96b1 Drop vwap fsp for now; causes hangs.. 2022-05-15 14:07:13 -04:00
Tyler Goodlet a727ca2557 Drop step routine import 2022-05-15 14:07:13 -04:00
Tyler Goodlet 847e5319b5 Drop uppx guard around downsamples on interaction
Since downsampling with the more correct version of m4 (uppx driven
windows sizing) is super fast now we don't need to avoid downsampling
on low uppx values. Further all graphics objects now support in-view
slicing so make sure to use it on interaction updates. Pass in the view
profiler to update method calls for more detailed measuring.

Even moar,
- Add a manual call to `.maybe_downsample_graphics()` inside the mouse
  wheel event handler since it seems that sometimes trailing events get
  lost from the `.sigRangeChangedManually` signal which can result in
  "non-downsampled-enough" graphics on chart given the scroll amount;
  this manual call seems to entirely fix this?
- drop "max zoom" guard since internals now support (near) infinite
  scroll out to graphics becoming a single pixel column line XD
- add back in commented xrange signal connect code for easy testing to
  verify against range updates not happening without it
2022-05-15 14:07:13 -04:00
Tyler Goodlet fee8a76222 WIP get incremental step curve updates working
This took longer then i care to admit XD but it definitely adds a huge
speedup and with only a few outstanding correctness bugs:

- panning from left to right causes strange trailing artifacts in the
  flows fsp (vlm) sub-plot but only when some data is off-screen on the
  left but doesn't appear to be an issue if we keep the `._set_yrange()`
  handler hooked up to the `.sigXRangeChanged` signal (but we aren't
  going to because this makes panning way slower). i've got a feeling
  this is a bug todo with the device coordinate cache stuff and we may
  need to report to Qt core?
- factoring out the step curve logic from
  `FastAppendCurve.update_from_array()` (un)fortunately required some
  logic branch uncoupling but also meant we needed special input controls
  to avoid things like redraws and curve appends for special cases,
  this will hopefully all be better rectified in code when the core of
  this method is moved into a renderer type/implementation.
- the `tina_vwap` fsp curve now somehow causes hangs when doing erratic
  scrolling on downsampled graphics data. i have no idea why or how but
  disabling it makes the issue go away (ui will literally just freeze
  and gobble CPU on a `.paint()` call until you ctrl-c the hell out of
  it). my guess is that something in the logic for standard line curves
  and appends on large data sets is the issue?

Code related changes/hacks:
- drop use of `step_path_arrays_from_1d()`, it was always a bit hacky
  (being based on `pyqtgraph` internals) and was generally hard to
  understand since it returns 1d data instead of the more expected (N,2)
  array of "step levels"; instead this is now implemented (uglily) in
  the `Flow.update_graphics()` block for step curves (which will
  obviously get cleaned up and factored elsewhere).
- add a bunch of new flags to the update method on the fast append
  curve:  `draw_last: bool`, `slice_to_head: int`, `do_append: bool`,
  `should_redraw: bool` which are all controls to aid with previously
  mentioned issues specific to getting step curve updates working
  correctly.
- add a ton of commented tinkering related code (that we may end up
  using) to both the flow and append curve methods that was written as
  part of the effort to get this all working.
- implement all step curve updating inline in `Flow.update_graphics()`
  including prepend and append logic for pre-graphics incremental step
  data maintenance and in-view slicing as well as "last step" graphics
  updating.

Obviously clean up commits coming stat B)
2022-05-15 14:07:13 -04:00
Tyler Goodlet 64de90e482 Drop cursor debounce delay, decrease rate limit 2022-05-15 14:07:13 -04:00
Tyler Goodlet 8ad6f7890a Downsample on every uppx inrement since it's way faster 2022-05-15 14:07:13 -04:00
Tyler Goodlet 1d63a71de3 Drop log scaling support since uppx driven scaling seems way faster/better 2022-05-15 14:07:13 -04:00
Tyler Goodlet 88ba1765ba Hipshot, use uppx to drive theoretical px w 2022-05-15 14:07:13 -04:00
Tyler Goodlet 621cbdd015 Fix null match 2022-05-15 14:07:13 -04:00
Tyler Goodlet 243a9aa905 WIP incrementally update step array format 2022-05-15 14:07:13 -04:00
Tyler Goodlet a1de89d825 Always maybe render graphics
Since we have in-view style rendering working for all curve types
(finally) we can avoid the guard for low uppx levels and without losing
interaction speed. Further don't delay the profiler so that the nested
method calls correctly report upward - which wasn't working likely due
to some kinda GC collection related issue.
2022-05-15 14:07:13 -04:00
Tyler Goodlet 50b86247af Always set coords cache on curves 2022-05-15 14:07:13 -04:00
Tyler Goodlet 4cd8668059 Handle null output case for vlm chart mxmn 2022-05-15 14:07:13 -04:00
Tyler Goodlet 1fbfbf4e4c Right, handle the case where the shm prepend history isn't full XD 2022-05-15 14:07:13 -04:00
Tyler Goodlet e388f57e47 Always use coord cache, add naive view range diffing logic 2022-05-15 14:07:13 -04:00
Tyler Goodlet dbdb548f7f Put mxmn profile mapping at end of method 2022-05-15 14:07:13 -04:00
Tyler Goodlet c69be8b599 If a sample stream is already ded, just warn 2022-05-15 14:07:13 -04:00
Tyler Goodlet 45c5725d61 `FastAppendCurve`: Only render in-view data if possible
More or less this improves update latency like mad. Only draw data in
view and avoid full path regen as much as possible within a given
(down)sampling setting. We now support append path updates with in-view
data and the *SPECIAL CAVEAT* is that we avoid redrawing the whole curve
**only when** we calc an `append_length <= 1` **even if the view range
changed**. XXX: this should change in the future probably such that the
caller graphics update code can pass a flag which says whether or not to
do a full redraw based on it knowing where it's an interaction based
view-range change or a flow update change which doesn't require a full
path re-render.
2022-05-15 14:07:13 -04:00
Tyler Goodlet 46fb3004a1 Remove `._set_yrange()` handler from x-range-change signal 2022-05-15 14:07:13 -04:00
Tyler Goodlet 39f416efa0 Delegate graphics cycle max/min to chart/flows 2022-05-15 14:07:13 -04:00
Tyler Goodlet 9a716de36d Incrementally update flattend OHLC data
After much effort (and exhaustion) but failure to get a view into our
`numpy` OHLC struct-array, this instead allocates an in-thread-memory
array which is updated with flattened data every flow update cycle.

I need to report what I think is a bug to `numpy` core about the whole
view thing not working but, more or less this gets the same behaviour
and minimizes work to flatten the sampled data for line-graphics drawing
thus improving refresh latency when drawing large downsampled curves.

Update the OHLC ds curve with view aware data sliced out from the
pre-allocated and incrementally updated data (we had to add a last index
var `._iflat` to track appends - this should be moved into a renderer
eventually?).
2022-05-15 14:07:13 -04:00
Tyler Goodlet a05566ab53 Add `FastAppendCurve.draw_last()` 2022-05-15 14:07:13 -04:00
Tyler Goodlet e02d6f156e Don't require data input to constructor 2022-05-15 14:07:13 -04:00
Tyler Goodlet bafa1a02a5 More WIP, implement `BarItems` rendering in `Flow.update_graphics()` 2022-05-15 14:07:13 -04:00
Tyler Goodlet 4877aee729 Add `BarItems.draw_last()` and disable `.update_from_array()` 2022-05-15 14:07:13 -04:00