Commit 660d72ed authored by Kruyff,D.L.W. (Dylan)'s avatar Kruyff,D.L.W. (Dylan)
Browse files

Bug fix: display correct query position in tables

parent f7d56127
......@@ -73,7 +73,6 @@ export class CacheService {
async getSimilarWindows(): Promise<any> {
this.windowSimilarity = await this.api.getSimilarWindows(this._queryWindow, this.tables);
console.log(this.windowSimilarity);
return this.windowSimilarity;
}
......@@ -87,7 +86,6 @@ export class CacheService {
async getQueryWindow(window): Promise<number[]> {
this.queryWindow = await this.api.getQueryWindow(window);
console.log(this._queryWindow);
return this._queryWindow;
}
......
......@@ -136,7 +136,6 @@ export class OverviewWindowComponent implements OnInit {
this.series[1].values = this.goodLabels;
this.series[2].values = this.badLabels;
this.config.scaleX.markers = this.markers;
console.log(this.config);
zingchart.exec("zingchart-ng-1", 'setdata', {
data: this.config
});
......@@ -149,10 +148,8 @@ export class OverviewWindowComponent implements OnInit {
console.log("Updating chart");
let candidates = [];
for (let i = sliderIndex; i < this.service.nrOfTables; i++) {
console.log(i);
candidates = candidates.concat(this.service.windowSimilarity[sliderIndex.toString()]);
}
console.log(candidates);
const labels = [];
const markers = [];
for (const index of candidates) {
......
......@@ -22,7 +22,6 @@ export class TableOverviewComponent implements OnInit {
}
averagePlot(average): object {
console.log(average);
return {
data: [
{
......@@ -103,28 +102,30 @@ export class TableOverviewComponent implements OnInit {
const listOfWindows = [];
for (const tableIndex in this.tables) {
const table = this.tables[tableIndex];
let rank = undefined;
let opacity = new Array(Object.keys(table.entries).length);
opacity.fill(1);
const orderedHashes = Object.keys(table.entries).sort((hash1, hash2) => {
return this.distanceMetric(hash1) - this.distanceMetric(hash2);
});
if (this.service.queryWindow) {
const queryEntry = this.calculateSignature(table.hash, this.service.queryWindow);
listOfWindows.push(table.entries[queryEntry]);
opacity = Object.keys(table.entries).map((hash: string) => {
opacity = orderedHashes.map((hash: string) => {
return hash === queryEntry ? 1.0 : 0.5;
}
);
rank = table.entries[queryEntry].length;
}
const orderedHashes = Object.keys(table.entries).sort((hash1, hash2) => {
return this.distanceMetric(hash1) - this.distanceMetric(hash2);
});
console.log(orderedHashes);
this.subplots.push(
{
rank: rank,
data: [{
x: orderedHashes.map((hash: string) => {
return Number('0b' + hash);
x: orderedHashes.map((hash: string, i) => {
return i; // Number('0b' + hash);
}
),
y: orderedHashes.map((hash: string) => table.entries[hash].length / (this.service.rawValues.length - this.service.windowSize)),
y: orderedHashes.map((hash: string) => table.entries[hash].length ), // / (this.service.rawValues.length - this.service.windowSize)),
type: 'bar',
marker: {
opacity
......@@ -152,8 +153,8 @@ export class TableOverviewComponent implements OnInit {
}
);
}
this.subplots.sort((plot1, plot2) => plot1.rank - plot2.rank);
if (this.service.queryWindow) {
console.log(listOfWindows);
const temp = await this.service.getAverageTableWindows(listOfWindows);
this.averages = temp.map(x => this.averagePlot(x));
}
......
......@@ -2,7 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="556080ba-825c-4b55-a92a-867a4df4fb32" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../AngularApp/prototype/src/app/progress-view/progress-view.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
......@@ -16,8 +15,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="161" column="15" lean-forward="true" selection-start-line="161" selection-start-column="15" selection-end-line="161" selection-end-column="15" />
<state relative-caret-position="262">
<caret line="166" column="34" lean-forward="true" selection-start-line="166" selection-start-column="34" selection-end-line="166" selection-end-column="34" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
......@@ -142,15 +141,15 @@
<workItem from="1599487808817" duration="1192000" />
<workItem from="1599578907139" duration="8436000" />
<workItem from="1599661275060" duration="1249000" />
<workItem from="1600001984238" duration="3064000" />
<workItem from="1600001984238" duration="4555000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="97120000" />
<option name="totallyTimeSpent" value="98611000" />
</component>
<component name="ToolWindowManager">
<frame x="-7" y="-7" width="1295" height="695" extended-state="7" />
<frame x="-7" y="-7" width="1295" height="695" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.28698465" />
......@@ -209,8 +208,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="161" column="15" lean-forward="true" selection-start-line="161" selection-start-column="15" selection-end-line="161" selection-end-column="15" />
<state relative-caret-position="262">
<caret line="166" column="34" lean-forward="true" selection-start-line="166" selection-start-column="34" selection-end-line="166" selection-end-column="34" />
<folding>
<element signature="e#0#41#0" expanded="true" />
</folding>
......
......@@ -165,13 +165,17 @@ def average_table():
t1 = time()
actual_windows = data[windows]
print(len(actual_windows))
max_values = np.maximum.reduce(actual_windows).tolist()
min_values = np.minimum.reduce(actual_windows).tolist()
average_values = (np.sum(actual_windows, 0) / len(actual_windows)).tolist()
average_values = np.average(actual_windows, 0)
# average_values = (np.sum(actual_windows, 0) / len(actual_windows))
std_values = np.std(actual_windows, 0)
max_values = average_values + std_values
min_values = average_values - std_values
# max_values = np.maximum.reduce(actual_windows).tolist()
# min_values = np.minimum.reduce(actual_windows).tolist()
output.append({
'average': average_values,
'max': max_values,
'min': min_values
'average': average_values.tolist(),
'max': max_values.tolist(),
'min': min_values.tolist()
})
print("Average calculated: " + str(time() - t1))
response = orjson.dumps(output)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment