Comments (5)
Yo. Yes, sorry, the error level was not properly plumbed in, bugfix coming. The log_level doesn't attach to anything, I'm going to remove it. The logger.level is a standard python logger.level, so 0 means 'not set, use default' (which is usually 30) - set to 1 for maximum messages.
from nibabel.
Oh - but reading your email, you wanted messages during ordinary operation like 'adding 2 and 2 to get total of 4, storing in variable "result"' type thing? The logging only happens for fixing header inconsistencies. You could obviously drop logging decorators on the functions you were interested in, but to put logging stuff all over the code seems like it would make it slower and harder to read.
from nibabel.
yes -- sorry for not making it clear -- I wanted logging of the basic operations performed. Not really '1+1=2' type, but more of
> vol = nib.load('file.nii.gz')
Loading Nifti1Header from file.nii.gz
Verifying the header
...... here warnings might come .....
> h = vol.get_header()
Constructed a copy of the header
> qform = h.get_qform()
Computing qform
> vol.to_filename('file2.nii.gz')
Loading data from file.nii.gz
Loading 10x10x10x1000 volume of dtype=int16
Scaling data using scale=0.3 and interc=0. into dtype=float32
Storing header into file2.nii.gz
Storing data into file2.nii.gz
Quantizing data using scale=0.3 and interc=0. into dtype=int16
Something like that.
I might be wrong in the above sequence of events (since I am not sure now what it is), and I space-indented according to the level (our practice in pymvpa's logger), although I guess it will not be the case with default Python logger especially since you have quite high levels for some messages, thus indenting them that far might be too much ;-)
Also because warnings and errors are already at higher levels, this detailed information about actions should probably at even higher levels
If messages are just strings with not much of '%s' and '%r' it should not cause significant slowdown -- majority of time would be taken by logic and I/O. But, additionally, you could make them printed out only in debug mode.
In PyMVPA we have lots of "debug" messages "printed" this way and I do not think we incured much of slowdown -- I could check what is the run time with -O vs without if you like
from nibabel.
Hrrm - that seems like there'd be a lot of logging. Is it the scalefactor in particular that you wanted logged?
from nibabel.
Well -- those were just concrete examples of what relevant issues I ran into recently... for others there could be others. And I think controllable "a lot" is much better than "none". Moreover such debug output could be of great help to the developers of 3rd party software using nibabel as the backend, so those messages, if log level set appropriate, would become a part of bigger "picture" possibly shining the light on the possible underlying problem without getting into pdb
from nibabel.
Related Issues (20)
- `file` constructor in `doc/source/devel/register_me.py` HOT 6
- Add test runners for non-x86/x64 architectures
- Segfaulting on test_array_interface_with_dtype and numpy 2.0-dev HOT 3
- 1 test fails: test_pkg_info HOT 3
- Request: stop throwing ExpiredDeprecationError HOT 23
- Add M1 runners
- Shape mismatch HOT 1
- Please port to Python3.12 HOT 3
- python-nibabel fails to build with Python 3.13: AttributeError: module 'logging' has no attribute 'warn'; indentation in docstrings mismatch, AssertionError HOT 2
- Is support for memory maps discontinued? HOT 2
- Might lead to MemoryError on i386 HOT 3
- Trying to access dlabel.nii dynamic field HOT 1
- Noisy UserWarning is thrown (`np.longdouble`) when importing `nibabel` with `numpy>=1.25` on WSL1 HOT 2
- Two tests are failing in 5.2.1 with Python 3.13.0a5
- 270 tests fail because of quote issues HOT 3
- BUG: Bug with NumPy 2.0 HOT 3
- Add free-threaded CI build HOT 1
- data.shape has one more dimension HOT 1
- Unable to save extra information to the 'extra' field of a nifti1 image HOT 1
- NIfTI Extension redesign
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nibabel.