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

LIMS-140: Fix pia_estimated_d_min display on VMXi grid scans #678

Merged
Merged
Changes from all commits
Commits
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
27 changes: 23 additions & 4 deletions client/src/js/modules/dc/views/gridplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ define(['jquery', 'marionette',
this.statusesLoaded = false
this.listenTo(options.imagestatuses, 'sync', this.setStatues, this)
this.noHeatMapResult = []
this.invertHeatMap = false

this._ready = []

Expand Down Expand Up @@ -130,6 +131,8 @@ define(['jquery', 'marionette',

loadAttachment: function() {
var a = this.attachments.findWhere({ 'DATACOLLECTIONFILEATTACHMENTID': this.ui.ty2.val() })
var selectedOption = this.ui.ty2.find('option:selected').text()
this.invertHeatMap = selectedOption === 'pia_estimated_d_min'
if (a) {
if (!a.get('DATA')) {
var self = this
Expand Down Expand Up @@ -411,12 +414,15 @@ define(['jquery', 'marionette',

if (d.length > 0) {
let max = 0
let power = this.invertHeatMap ? -1 : 1
let val = 0
_.each(d, function(v) {
if (v[1] > max) max = v[1]
val = Math.pow(v[1], power)
if (val > max) max = val
})

max = max === 0 ? 1 : max
if (this.getOption('padMax') && max < 10) max = max * 50
if (this.getOption('padMax') && max < 10 && !this.invertHeatMap) max = max * 50

var sw = (this.perceivedw-(this.offset_w*this.scale))/this.grid.get('STEPS_X')
var sh = (this.perceivedh-(this.offset_h*this.scale))/this.grid.get('STEPS_Y')
Expand All @@ -427,6 +433,7 @@ define(['jquery', 'marionette',
var data = []
_.each(d, function(v) {
var k = v[0] - 1
val = Math.pow(v[1], power)

// Account for vertical grid scans
let xstep, ystep, x, y
Expand Down Expand Up @@ -454,7 +461,10 @@ define(['jquery', 'marionette',
}

// Dont zero values < 1 if data is scaled to max==1
data.push({ x: x, y: y, value: v[1] < 1 && max > 1 ? 0 : v[1],
data.push({
x: x,
y: y,
value: val < 1 && max > 1 ? 0 : val,
radius: radius
})

Expand Down Expand Up @@ -514,7 +524,16 @@ define(['jquery', 'marionette',

_getVal: function(pos) {
var val = null
const d = Number(this.ui.ty.val()) > -1 ? this.distl.get('data')[Number(this.ui.ty.val())] : []
let d = []
if (this.ui.ty.is(":visible")) {
d = Number(this.ui.ty.val()) > -1 ? this.distl.get('data')[Number(this.ui.ty.val())] : []
}
if (this.ui.ty2.is(":visible")) {
let a = this.attachments.findWhere({ 'DATACOLLECTIONFILEATTACHMENTID': this.ui.ty2.val() })
if (a && a.get('DATA')) {
d = a.get('DATA')
}
}
_.each(d, function(v) {
// 1 indexed array
if (v[0] === pos+1) {
Expand Down
Loading