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
SYSTEM_ERROR_CHECK(pipef=popen("gnuplot", "w"), NULL, "Calling gnuplot");
switch (input->dims_nb){
case 0:
columns_nb=1;
rows_nb=1;
break;
case 1:
columns_nb=input->dims[0].length;
rows_nb=1;
break;
case 2:
columns_nb=input->dims[0].length;
rows_nb=input->dims[1].length;
break;
default:
EXIT_ON_ARRAY_ERROR(input, "Too many dims");
break;
case 0:
columns_nb=1;
rows_nb=1;
break;
case 1:
columns_nb=input->dims[0].length;
rows_nb=1;
break;
case 2:
columns_nb=input->dims[0].length;
rows_nb=input->dims[1].length;
break;
default:
EXIT_ON_ARRAY_ERROR(input, "Too many dims");
break;
}
element_size=input->get_type_size();
switch (input->type){
case 'UIN8':
gnuplot_format="%uchar";
element_size=sizeof(uchar);
break;
case 'INT8':
gnuplot_format="%char";
element_size=sizeof(char);
break;
case 'FL32':
gnuplot_format="%float";
element_size=sizeof(float);
break;
default: EXIT_ON_ARRAY_ERROR(input, "The type is not managed");
case 'UIN8':gnuplot_format="%uchar";break;
case 'INT8':gnuplot_format="%char";break;
case 'IN16':gnuplot_format="%int16";break;
case 'UI16':gnuplot_format="%uint16";break;
case 'IN32':gnuplot_format="%int32";break;
case 'UI32':gnuplot_format="%uint32";break;
case 'FL32':gnuplot_format="%float32";break;
case 'FL64':gnuplot_format="%float64";break;
default: EXIT_ON_ARRAY_ERROR(input, "The type is not managed");
}
init_term(pipef, title, verbatim);
......@@ -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 (input->dims_nb==2){
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 zrange [%f:%f]\n", min, max);
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);
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 zrange [%f:%f]\n", min, max);
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);
}
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);
for(i=1; i!=rows_nb; i++){
if (i<10) code=48+i;
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, 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++){
if (i<10) code=48+i;
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);
}
}
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