Commit 4cd9bc22 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Manage all blc_array types (i.e. UI32)

parent a0a0b23e
Pipeline #45 failed with stages
...@@ -31,37 +31,33 @@ void create_graph(blc_channel *input, char const *title, int refresh_period, flo ...@@ -31,37 +31,33 @@ void create_graph(blc_channel *input, char const *title, int refresh_period, flo
SYSTEM_ERROR_CHECK(pipef=popen("gnuplot", "w"), NULL, "Calling gnuplot"); SYSTEM_ERROR_CHECK(pipef=popen("gnuplot", "w"), NULL, "Calling gnuplot");
switch (input->dims_nb){ switch (input->dims_nb){
case 0: case 0:
columns_nb=1; columns_nb=1;
rows_nb=1; rows_nb=1;
break; break;
case 1: case 1:
columns_nb=input->dims[0].length; columns_nb=input->dims[0].length;
rows_nb=1; rows_nb=1;
break; break;
case 2: case 2:
columns_nb=input->dims[0].length; columns_nb=input->dims[0].length;
rows_nb=input->dims[1].length; rows_nb=input->dims[1].length;
break; break;
default: default:
EXIT_ON_ARRAY_ERROR(input, "Too many dims"); EXIT_ON_ARRAY_ERROR(input, "Too many dims");
break; break;
} }
element_size=input->get_type_size();
switch (input->type){ switch (input->type){
case 'UIN8': case 'UIN8':gnuplot_format="%uchar";break;
gnuplot_format="%uchar"; case 'INT8':gnuplot_format="%char";break;
element_size=sizeof(uchar); case 'IN16':gnuplot_format="%int16";break;
break; case 'UI16':gnuplot_format="%uint16";break;
case 'INT8': case 'IN32':gnuplot_format="%int32";break;
gnuplot_format="%char"; case 'UI32':gnuplot_format="%uint32";break;
element_size=sizeof(char); case 'FL32':gnuplot_format="%float32";break;
break; case 'FL64':gnuplot_format="%float64";break;
case 'FL32': default: EXIT_ON_ARRAY_ERROR(input, "The type is not managed");
gnuplot_format="%float";
element_size=sizeof(float);
break;
default: EXIT_ON_ARRAY_ERROR(input, "The type is not managed");
} }
init_term(pipef, title, verbatim); init_term(pipef, title, verbatim);
...@@ -71,20 +67,20 @@ void create_graph(blc_channel *input, char const *title, int refresh_period, flo ...@@ -71,20 +67,20 @@ void create_graph(blc_channel *input, char const *title, int refresh_period, flo
if (xmin!=xmax) fprintf(pipef, "set xrange [%f:%f]\n", xmin, xmax); if (xmin!=xmax) fprintf(pipef, "set xrange [%f:%f]\n", xmin, xmax);
if (input->dims_nb==2){ if (input->dims_nb==2){
fprintf(pipef, "set xrange [%f:%f]\n", 0.f, 10.f); fprintf(pipef, "set xrange [%f:%f]\n", 0.f, 10.f);
fprintf(pipef, "set yrange [%f:%f]\n", 0.f, 10.f); fprintf(pipef, "set yrange [%f:%f]\n", 0.f, 10.f);
fprintf(pipef, "set zrange [%f:%f]\n", min, max); fprintf(pipef, "set zrange [%f:%f]\n", min, max);
fprintf(pipef, "set view 30,190\n"); fprintf(pipef, "set view 30,190\n");
offset=snprintf(command, LINE_MAX, "splot '-' binary format='%s' array=%dx%d title 'values' with pm3d ", gnuplot_format, columns_nb, rows_nb); offset=snprintf(command, LINE_MAX, "splot '-' binary format='%s' array=%dx%d title 'values' with pm3d ", gnuplot_format, columns_nb, rows_nb);
} }
else{ else{
offset=snprintf(command, LINE_MAX, "plot '-' binary format='%s' record=%d using ($0*%f):1 title '%d' with %s", gnuplot_format, columns_nb, label_max/(float)columns_nb, 0, with_option); offset=snprintf(command, LINE_MAX, "plot '-' binary format='%s' record=%d using ($0*%f):1 title '%d' with %s", gnuplot_format, columns_nb, label_max/(float)columns_nb, 0, with_option);
for(i=1; i!=rows_nb; i++){ for(i=1; i!=rows_nb; i++){
if (i<10) code=48+i; if (i<10) code=48+i;
else code=97+i-10; else code=97+i-10;
offset+=snprintf(command+offset, LINE_MAX-offset, ", '-' binary format='%s' record=%d title '%c' with %s", gnuplot_format, columns_nb, code, with_option); offset+=snprintf(command+offset, LINE_MAX-offset, ", '-' binary format='%s' record=%d title '%c' with %s", gnuplot_format, columns_nb, code, with_option);
} }
} }
buffer=MANY_ALLOCATIONS(input->size, char); buffer=MANY_ALLOCATIONS(input->size, char);
......
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