wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
459 stars 96 forks source link

Reading tab-delimited datafiles #1920

Closed ReneSci closed 1 month ago

ReneSci commented 1 month ago

I often use maxima/wxMaxima to read tab-delimited data files and is has been working like charm when using

Stream : openr(directory(DataFile[1])[1]);
" some loop :" ;
dataLine : readline(Stream);
- "data-handling code"

However during some of the latest Nightly Builds the readline() noes not read the TAB-character anymore :-(

I has to revert back to a build I have on my computer from 2024/01/30 to get it to work

The next build, I have stored on my computer, is 2024/03/20, but this one and later builds contains the above failure.

I would be very pleased if you can help !

Runs wxMaxima on windows 11 / 64 bit

gunterkoenigsmann commented 1 month ago

I always use read_matrix() for that purpose which Robert Dodier has optimized for speed quite a bit. And on my computer readline() actually returns a string that contains TABs:

(%i1)   Stream : openr("test.txt");
*** Deprecated defmvar option: STRING for $NEWLINE

*** Deprecated defmvar option: STRING for $TAB

*** Deprecated defmvar option: STRING for $SPACE

(Stream)    \#\{Stream \[CHARACTER\]
(%i2)   readline(Stream);
(%o2)   "1       2       3"
(%i3)   readline(Stream);
(%o3)   "4       5       6"
(%i4)   readline(Stream);
(%o4)   "7       8       9"

What does your build_info() say? Mine reads:

(%i1)   build_info();
(%o1)   build_info(version="branch_5_47_base_1162_g826a1a361_dirty",timestamp=
"2024-05-24 21:30:24",host="x86_64-pc-linux-gnu",lisp_name="SBCL",lisp_version
="2.2.9.debian",maxima_userdir="/home/gunter/.maxima",maxima_tempdir="/tmp"
,maxima_objdir=
"/home/gunter/src/maxima-code/binary/branch_5_47_base_1162_g826a1a361_dirty/sbcl/2_2_9_debian"
,maxima_frontend="wxMaxima",maxima_frontend_version=
"24.05.0_DevelopmentSnapshot_GTK3")
ReneSci commented 1 month ago

The problem starts somewhere after build 2024/01/30 inclusive the latest build.

Unfortunately, I have to use the above manual (my own programming) to read the data files as they contain data in a mixed way:

/* Length=43.10 */
/* IntTime=30000 */
/* StrobeDelay=10000 */
/* Lamppower=1 */
/* Navg=33 */
/* UTCTime=20240507-143923 */
/* Latitude=nan */
/* Longitude=nan */
/* Speed=nan */
/* Heading=nan */
/* Temp=31.812000 */
189.182373 {tab} 0.427444
189.313156 {tab} 0.427444
189.443924 {tab} 0.427444
.
.
ReneSci commented 1 month ago

(%i190) build_info(); (%o190) build_info(version=""branch_5_47_base_1182_gdc9d6aaaf"",timestamp=""2024-05-23 23:52:16"",host=""x86_64-w64-mingw32"",lisp_name=""SBCL"",lisp_version=""2.4.4"",maxima_userdir= ""C:/Users/xxxxx/maxima"",maxima_tempdir=""C:/Users/xxx/AppData/Local/Temp"",maxima_objdir=""C:/Users/xxx/maxima/binary/branch_5_47_base_1182_gdc9d6aaaf/sbcl/2_4_4"", maxima_frontend=""wxMaxima"",maxima_frontend_version=""24.05.0_DevelopmentSnapshot_MSW"")

daute commented 1 month ago

This seems to be a Maxima issue and should be reported at the Maxima bugtracker, not here.

ReneSci commented 1 month ago

is that here ? https://sourceforge.net/p/maxima/bugs/

gunterkoenigsmann commented 1 month ago

Either that or https://sourceforge.net/p/maxima/mailman/maxima-discuss/.

They will definitely ask you for the symptom of the problem, which means: what exactly has changed for you.

ReneSci commented 1 month ago

Thanks. I did make a post there :-)

ReneSci commented 1 month ago

Arghh... my colleague has apparently decided to change "Vertical tab" (ascii 11) with "Horizontal tab" (ascii 9) in the data files

Also, the previous versions of maxima/wxMaxima has chaged the display of the string from:

"Old" maxima/wxMaxima:

headerLine : readline(Stream); "189.184875�22.000000"

map(cint, charlist(headerLine)); [49,56,57,46,49,56,52,56,55,53,9,50,50,46,48,48,48,48,48,48,13]

"New maxima/wxMaxima :

headerLine : readline(Stream); "189.18487522.000000"

map(cint, charlist(headerLine)); [49,56,57,46,49,56,52,56,55,53,9,50,50,46,48,48,48,48,48,48,13]


I did not previously include ascii 9 handling in my code together with wxMaxima not displaying the tab (189.184875�22.000000) anymore - that what did confuse me :-( Thanks for reminding me on map(cint, charlist(headerLine)) !! - I apologize for bothering you ...

daute commented 1 month ago

Closing the issue, not a wxMaxima bug. That the tab did not display as "�" (which is not a tabulator), is maybe an improved UTF-8 support of (wx)Maxima.