-
Notifications
You must be signed in to change notification settings - Fork 13
Experimental/recalib iter #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| /// have index 2 but its empty! | ||
| /// | ||
| /// Then this index can be converted using the Scan2ImConverter.convert | ||
| fn expand_mobility_iter(&self) -> impl Iterator<Item = u16> + '_ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think than an option to expand the peaks should be inside timsrust or at least this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this set up internally with a more generic with a SparseVec structure though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good to me.
| // These two are here so we can implement optimized versions for iterators if needed. | ||
| fn convert_iter( | ||
| &self, | ||
| values: impl Iterator<Item = f64>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably go for &[f64] rather than an impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason I made it this way was for things like the scan index, where we dont have a materialized slice.
| pub(crate) fn decompress_reset( | ||
| &mut self, | ||
| compressed_bytes: &[u8], | ||
| ) -> Result<(), TdfBlobError> { | ||
| self.bytes.clear(); | ||
| copy_decode(compressed_bytes, &mut self.bytes) | ||
| .map_err(|_| TdfBlobError::Decompression)?; | ||
| Self::check_len(self.bytes.as_slice())?; | ||
| Ok(()) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have some stats on how much better recycling allocated spae works compared to making new?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
real answer ... no ... if my memory serves me correctly it was less than 5% in my laptop. But I believe that would greatly depend on what allocator is being used (I have seen massive heap allocation overhead in windows but not mac, and using mimalloc in windows makes it go away, whilst it makes mac slower ... )
| pub peaks: FramePeaks, | ||
| pub meta: FrameMeta, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very good idea that I also have been wanting to implement for awhile already
| /// have index 2 but its empty! | ||
| /// | ||
| /// Then this index can be converted using the Scan2ImConverter.convert | ||
| fn expand_mobility_iter(&self) -> impl Iterator<Item = u16> + '_ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
| /// have index 2 but its empty! | ||
| /// | ||
| /// Then this index can be converted using the Scan2ImConverter.convert | ||
| fn expand_mobility_iter(&self) -> impl Iterator<Item = u16> + '_ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have this set up internally with a more generic with a SparseVec structure though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably want to put the actual reading elsewhere. I understand the tight coupling between the reader and metadata, but might opt to move the metadata definition to the reader rather than the otherway around...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No preference... the main thing here was that the reader struct is never constructed, so it was kind of annoying to 'import' two structs for no reason.
| pub dia_windows: Option<Vec<Arc<QuadrupoleSettings>>>, | ||
| pub frame_metas: Vec<FrameMeta>, | ||
| pub acquisition: AcquisitionType, | ||
| pub compression_type: u8, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I feel structs shoud not have pub fields. I actually need to revisit all those that still have this... (in particular frame)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I think ... we can break this up into two things...
- Should I have access to the data? -> I believe the answer is yes, I do not believe I should need to read the data to know how many MS1 frames I have, or how many quad types I am using. If you do not want to have that be pub that is cool, but a getter would be great to have.
- Should I have "write-access" to the field. -> Well ... I think that if I am writing to it its one me to not mess it up.
| /// Attempts to find the frame using the instrument index and | ||
| /// returns it if found. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to make explicit that the indices indeed are different in terms of accession (0-offset rather than 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure if that was the difference and if there could be gaps (which is why I used bin search instead of subtraction :P)
| frame_buffer: &mut Frame, | ||
| blob_buffer: &mut TdfBlob, | ||
| ) -> Result<(), FrameReaderError> { | ||
| frame_buffer.peaks.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a very quick glance I find it difficult to see if/how this maintains multithreaded compatability without getting overly complex. Care to elaborate? If not, I'll try to look up the details later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the real answer is you dont :P if the user (me) wants to use this interface its on them to figure out the multi-threaded mutable state. (I use a per-thread buffer, but I can see someone else using an Arc<Mutex<Queue>>). You gain in alloc overhead but loose in threaded logic complexity as a user.
Well this is not really meant to be a "real" PR (but it can become one).
I guess I added a lot of stuff that worked for me and wanted to know if any of it would be of interest.