Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template for multiple weights with diff between histogram with di… #354

Merged
merged 26 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2acf69d
Add template for multiple weights with diff between histogram with di…
pl0xz0rz Mar 26, 2024
d524f7c
Bugfix for joins with cdsMain
pl0xz0rz Mar 27, 2024
f6210bb
Added histoXYWeight tab
pl0xz0rz Apr 1, 2024
e092c13
Bygfix
pl0xz0rz Apr 1, 2024
336fb20
Added histoXYNormWeights tab
pl0xz0rz Apr 2, 2024
1d4555e
Added tabs for histoXYZWeights and histoXYNormZWeights
pl0xz0rz Apr 3, 2024
672b311
Fixed X axis label
pl0xz0rz Apr 3, 2024
97ab2c5
Added diffFunc fo weights that can also be ratio or logRatio, simplif…
pl0xz0rz Apr 4, 2024
6fd2702
Added a per figure filter option, so far doesn't work properly
pl0xz0rz May 9, 2024
1963d6f
Fixed some wrong Y axis labels caused by copypaste fail
pl0xz0rz May 13, 2024
51bcbec
Fixed some wrong Y axis labels in histoXYNormZWeights
pl0xz0rz May 13, 2024
0bc350b
Fixed color axis title in histoXYWeightZNorm
pl0xz0rz May 13, 2024
c354a38
Fixed Y axis label for histoXYWeights join
pl0xz0rz May 13, 2024
f6366d5
Added Y axis label for histoXYNormWeights
pl0xz0rz May 13, 2024
d9444b7
Fixed axis labels
pl0xz0rz May 13, 2024
7aab3d8
Removed misleading error bars
pl0xz0rz May 13, 2024
0138f2f
Removed a misleading console.log
pl0xz0rz May 20, 2024
145ab44
Fixed ast.Num - deprecated and will be removed in future python versi…
pl0xz0rz May 20, 2024
a7451f7
Added entries cut, doesn't work yet, to be fixed
pl0xz0rz May 20, 2024
e049fb4
Fixed failing test_bokehDrawSA
pl0xz0rz May 23, 2024
3844a5b
Entries cut now works
pl0xz0rz May 23, 2024
d564ffc
Fixed failing tests - was caused by old histogram interface
pl0xz0rz May 23, 2024
f50e0a7
bugfix
pl0xz0rz May 23, 2024
2c9b490
Fixed bug with True is not defined
pl0xz0rz May 25, 2024
582ca6a
Fixed missing entries cut
pl0xz0rz May 25, 2024
980b041
Added entries cut to figures with delta
pl0xz0rz May 26, 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 RootInteractive/InteractiveDrawing/bokeh/CDSJoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CDSJoin(ColumnarDataSource):
on_left = List(String)
on_right = List(String)
prefix_left = String(help="Prefix to use for columns in the left column data source")
prefix_right = String(help="Prefix to use for columns in the left column data source")
prefix_right = String(help="Prefix to use for columns in the right column data source")
how = String(default="inner")
tolerance = Float(default=1e-5)
print("Import ", __implementation__)
60 changes: 41 additions & 19 deletions RootInteractive/InteractiveDrawing/bokeh/CDSJoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ export class CDSJoin extends ColumnarDataSource {
_indices_left: number[] | null
_indices_right: number[] | null

cached_columns: Set<string>

initialize(){
super.initialize()
this.data = {}
this.cached_columns = new Set()
this.compute_indices()
}

Expand Down Expand Up @@ -73,6 +76,9 @@ export class CDSJoin extends ColumnarDataSource {
if (on_right.length === 0){
this._indices_left = null
this._indices_right = null
this.cached_columns.clear()
change.emit()
return
}
} else if(on_left.length === 1 && on_right.length === 0){
this._indices_left = null
Expand Down Expand Up @@ -176,30 +182,31 @@ export class CDSJoin extends ColumnarDataSource {
this._indices_left = indices_left
this._indices_right = indices_right
}
for (const key of left.columns()) {
const col = left.get_array(key)
if(col !== null) this.data[key] = this.join_column(col, this._indices_left)
}
for (const key of right.columns()) {
const col = right.get_array(key)
if(col !== null) this.data[key] = this.join_column(col, this._indices_right)
}
// selected.indices = this.source.selected.indices
this.cached_columns.clear()
change.emit()
}

get_column(key: string){
const {left, right, data} = this
if (data[key] != null) return data[key]
const {left, right, data, prefix_left, prefix_right} = this
if (this.cached_columns.has(key)) return data[key]
let column = null
try {
column = left.get_column(key)
}
catch {
column = right.get_column(key)
}
if (column == null){
column = right.get_column(key)
if (prefix_left && key.startsWith(prefix_left)){
let key_new = key.replace(prefix_left,"")
column = left.get_column(key_new)
} else if(prefix_right && key.startsWith(prefix_right)){
let key_new = key.replace(prefix_right,"")
column = right.get_column(key_new)
} else {
try {
column = left.get_column(key)
}
catch {
column = right.get_column(key)
}
if (column == null){
column = right.get_column(key)
}
}
if(column != null) {
if (!Array.isArray(column)){
Expand All @@ -208,11 +215,26 @@ export class CDSJoin extends ColumnarDataSource {
data[key] = this.join_column(column, this._indices_right)
}
}
this.cached_columns.add(key)
return data[key]
}

get_length(){
if (this._indices_left == null) return 0
if (this._indices_left == null){
if(this._indices_right == null){
let l = this.left.get_length()
if(l == null){
return this.right.get_length()
}
let r = this.right.get_length()
if(r == null){
return l
}
return Math.min(l, r)
} else {
return this._indices_right.length
}
}
return this._indices_left.length
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class ConcatenatedString extends Model {
compute(): string{
if (this.#is_dirty){
this.#value = String.prototype.concat(...this.components)
this.#is_dirty = false
}
return this.#value
}
Expand Down
11 changes: 8 additions & 3 deletions RootInteractive/InteractiveDrawing/bokeh/DownsamplerCDS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class DownsamplerCDS extends ColumnDataSource {
this.low = 0
this.high = -1
this._needs_update = true
this._is_trivial = false
this._is_trivial = this.nPoints < 0 && this.filter == null
this._cached_columns = new Set()
}

Expand Down Expand Up @@ -86,8 +86,10 @@ export class DownsamplerCDS extends ColumnDataSource {
update(){
const {source, nPoints, selected, filter, _indices} = this
const l = source.length
console.log(this.name)
if(filter == null && (nPoints < 0 || nPoints >= l)){
this._is_trivial = true
this._needs_update = false
return
}
if(nPoints < 0 || nPoints >= l){
Expand Down Expand Up @@ -226,6 +228,9 @@ export class DownsamplerCDS extends ColumnDataSource {
}
}

//Needed because of typescript, is supposed to be a nop
on_visible_change(){}
on_visible_change(){
if(this.watched && this._needs_update){
this.change.emit()
}
}
}
9 changes: 6 additions & 3 deletions RootInteractive/InteractiveDrawing/bokeh/LazyTabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ export namespace LazyTabs {
const {active, _last_index} = this
const old_renderers = this.renderers[_last_index]
for(let i=0; i<old_renderers.length; i++){
old_renderers[i].watched = false
old_renderers[i].properties.watched._value = false
old_renderers[i].on_visible_change()
}
const active_renderers = this.renderers[active]
for(let i=0; i<active_renderers.length; i++){
active_renderers[i].watched = true
active_renderers[i].properties.watched._value = true
active_renderers[i].on_visible_change()
}
this._last_index = active
}
Expand All @@ -75,7 +77,8 @@ export namespace LazyTabs {
const {_last_index, watched} = this
const active_renderers = this.renderers[_last_index]
for(let i=0; i<active_renderers.length; i++){
active_renderers[i].watched = watched
active_renderers[i].properties.watched._value = watched
active_renderers[i].on_visible_change()
}
// tabs[_last_index].child.visible = visible
}
Expand Down
Loading