-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
including input table as metadata in Table like in astropy.io.fits and io.fits HDUList.data/header #6429
Comments
I think it's not worth it to subclass However, I'm undecided about having it on No idea about |
Thanks for the response, just to add that in principle any user can use the meta attribute in Table to store the input filename. table.meta['filename'] = filename I am advocating that from a scientific point of view it would be good practice if the input filename was a defined attribute. I would argue that just is just as important as image or table column units; the input filename is a fundamental descriptor. |
Agreed on the importance as well as on the difficulty: what happens when you create a new table, or join two tables? Or read from a filehandle? And should this particular bit of metadata be saved if you write to a file? If so, what should the filename be when the table is read back in? MIDAS partially solved this by having a |
I'm not arguing that the filename isn't important. That's one thing I really liked about However cascading the filename can't be the only option. I agree that it might be important for But I'm open for discussion about this. Except for adding it to the |
In STScI FITS files, most of them has But my point is, if you want filename in I agree with the above point that it is difficult to get "filename" attribute in sync if carried around "officially". If I read in a file, and then modified its buffer without saving it back to the same filename, then the "filename" attribute can be misleading. |
For info, I have been reading a hdf5 file and it has a filename attribute which stores the name of the input file. I think it would be shared good practice to have filename metadata in a Table e.g. I accept the point that there is some danger if the table content is changed. Maybe this needs to be managed in some way with another piece of metadata that indicates that there has been a table change. This could just be binary; True/False. |
yeah, but that And it's very easy to add it manually so a simple custom wrapper would be enough to keep the filename around if one needs it and it makes it clearer that it's the responsibility of the user to keep the contents in sync or not. |
astropy.io.fits has a method HDUList.filename() which contains the filename of the file that is read in.
From a data provenance point of view, this is very useful and it would be useful if functionality was also in astropy Table.
It would be also be convenient if the filename was carried forward into the Header and Data 'objects' in astropy.io.fits.
i.e. print(data.filename()) would print the filename that the header came from.
http://docs.astropy.org/en/stable/io/fits/api/hdulists.html
Thanks
The text was updated successfully, but these errors were encountered: