Skip to content

Conversation

@FreddieAkeroyd
Copy link
Member

@FreddieAkeroyd FreddieAkeroyd commented Sep 19, 2025

Proposal for an NXtextlog base class, this is similar to NXlog but specifically for text based data as NXlog only supports numeric data. It could be used for example to record status/error/log messages from hardware or software and meant to handle cases where a large number of NXnote entries is undesirable. See #1432 and #1591

The implementation below currently has the option of a separator attribute to tell the reader how to split an indiidual value, but i'm not sure how useful that may or may not be. It may just be better to write multiple values in one log with the same timestamp, or as separate NXtextlog entries, for these cases.

Other questions might be:

  • should there be a text encoding attribute or just mandate UTF-8
  • is it useful to allow an optional end-of-line character to be specified, or just leave that interpretation for the reader

@FreddieAkeroyd FreddieAkeroyd force-pushed the add-nxtextlog-base-class branch 2 times, most recently from 7e236e9 to 7d588bd Compare September 19, 2025 23:55
@FreddieAkeroyd FreddieAkeroyd force-pushed the add-nxtextlog-base-class branch from 7d588bd to 78f0cd6 Compare September 20, 2025 00:03
@rayosborn
Copy link
Contributor

Is it really necessary to create a new base class? Can't we just add a text array as an option to the NXlog class? We have just added dozens of new base classes, so perhaps I shouldn't complain about an extra one, but I think we need to be clear if it's really necessary.

@FreddieAkeroyd
Copy link
Member Author

FreddieAkeroyd commented Sep 21, 2025

Hi Ray, this PR is in relation to #1432 which I forgot to reference in the PR description (have added now). In a previous discussion on this in #687 the consensus seemed to favor not changing NXlog to allow non-numeric data, but as that was a few years ago it would be worth revisiting this discussion.

@ggoneiESS
Copy link

I agree with Ray, but given Pete's comments in the other MR, if modifying NXlog isn't a possibility then NXnote with a timestamp (which was suggested originally too) could work without a new base class (, right?)

@FreddieAkeroyd
Copy link
Member Author

FreddieAkeroyd commented Jan 19, 2026

NXnote has a single entry date timestamp field and binary data field. It could currently store a single or multiline log message, but if there are many messages created at different timestamps it would need to create note_1, note_2, etc. which could work but just seems a bit messy [it may need to have another field to say how many notes, or to search and count note_* entries, and may also need to put all these in a separate NXcollection group]. I can see arguments for not extending NXlog as it is currently clearly plotable data and changing means the client would now need to check for whether it was plotable or not etc. Maybe NXnote could be extended to allow multiple notes to be added e.g. date is now taken as the date of the first entry, and there could be an optional time_offset (or other name) array field that would be linked to the data field in a backward compatible way, maybe via a data_offset to show where next element started (which is starting to feel a bit like the mechanism for storing per frame events in NXevent_data though). I felt using a NXtextlog just looked a bit clearer, but a modified NXnote or many instances could probably work

@phyy-nx
Copy link
Contributor

phyy-nx commented Jan 20, 2026

From Jan 2026 telco, after discussing the various options including 1) this new base class, 2) changing NXlog to allow text data or 3) changing NXnote to allow timestamps, the cleanest option seems to be 1), so that's the proposal we'd like to go with. For now, this should go to contributed definitions, so a vote is not needed. Just need a approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants