@@ -71,9 +71,8 def index(request): | |||||
71 | 'An error occur adding file {}: {}'.format(filename.split('/')[-1], e) |
|
71 | 'An error occur adding file {}: {}'.format(filename.split('/')[-1], e) | |
72 | ) |
|
72 | ) | |
73 | else: |
|
73 | else: | |
74 | fs = FileSystemStorage(location='/tmp') |
|
74 | if os.path.exists(os.path.join('/tmp', 'overview', files[0].name + '.summary')): | |
75 | fs.save(files[0].name, files[0]) |
|
75 | os.remove(os.path.join('/tmp', 'overview', files[0].name + '.summary')) | |
76 | filename = os.path.join('/tmp', files[0].name) |
|
|||
77 | ext = filename.split('.')[-1] |
|
76 | ext = filename.split('.')[-1] | |
78 | if ext not in ('hdf5', 'h5'): |
|
77 | if ext not in ('hdf5', 'h5'): | |
79 | convert = True |
|
78 | convert = True |
@@ -468,12 +468,42 def plot_scatter(datatime,dataparam,paramname, error=[]): | |||||
468 | return plot |
|
468 | return plot | |
469 |
|
469 | |||
470 |
|
470 | |||
|
471 | def fill_gaps(x_buffer, y_buffer, z_buffer, delta): | |||
|
472 | ||||
|
473 | empty = numpy.full(y_buffer.shape, numpy.nan) | |||
|
474 | X = [x_buffer[0]] | |||
|
475 | Z = [z_buffer[:,0]] | |||
|
476 | print(z_buffer.shape) | |||
|
477 | ||||
|
478 | for i, x in enumerate(x_buffer[1:]): | |||
|
479 | last = X[-1] | |||
|
480 | while ((x-last)>delta*1.5): | |||
|
481 | last = last + delta | |||
|
482 | X.append(last) | |||
|
483 | Z.append(empty) | |||
|
484 | ||||
|
485 | X.append(x) | |||
|
486 | Z.append(z_buffer[:,i+1]) | |||
|
487 | ||||
|
488 | print(numpy.array(Z).T.shape) | |||
|
489 | return X, numpy.array(Z).T | |||
|
490 | ||||
|
491 | ||||
471 | def plot_heatmap(datatime,datarange,dataparam,paramname): |
|
492 | def plot_heatmap(datatime,datarange,dataparam,paramname): | |
472 | if (numpy.all(numpy.isnan(dataparam))): |
|
493 | if (numpy.all(numpy.isnan(dataparam))): | |
473 | plot = "There is no valid data available for this plot: Empty array" |
|
494 | plot = "There is no valid data available for this plot: Empty array" | |
474 | else: |
|
495 | else: | |
|
496 | datatime = numpy.array(datatime) | |||
|
497 | deltas = datatime[1:] - datatime[:-1] | |||
|
498 | print (deltas) | |||
|
499 | delta = numpy.median(deltas) | |||
|
500 | ||||
|
501 | print('DELTA: ', delta) | |||
|
502 | ||||
|
503 | X, Z = fill_gaps(datatime, numpy.array(datarange), dataparam, delta) | |||
|
504 | ||||
475 | fig = go.Figure() |
|
505 | fig = go.Figure() | |
476 |
fig.add_trace(go.Heatmap(x= |
|
506 | fig.add_trace(go.Heatmap(x=X, y=datarange, z=Z,colorscale='Jet',colorbar={"title":paramname})) | |
477 | fig.update_yaxes(title_text="range") |
|
507 | fig.update_yaxes(title_text="range") | |
478 | fig.update_xaxes(title_text="Time [LT]") |
|
508 | fig.update_xaxes(title_text="Time [LT]") | |
479 | fig.update_layout( |
|
509 | fig.update_layout( |
General Comments 0
You need to be logged in to leave comments.
Login now