-
Notifications
You must be signed in to change notification settings - Fork 13
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
--cols-file in fits importer #27
base: master
Are you sure you want to change the base?
Conversation
dtype = table.dtype.fields[name][0] | ||
setcols[name] = (dtype, dtype.type(val)) | ||
|
||
# Slurp the columns from file |
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 block of text is taken from the text importer.
src/lsd/importers/fits.py
Outdated
parser.add_argument('table', help='Name of the table into which to import', type=str) | ||
parser.add_argument('file', help='One or more fits files. If ending in .gz or .bz2, they are assumed to be compressed.', type=str, nargs='+') | ||
parser.add_argument('-c', '--cols', help='Comma separated list of <colname>:<file_column>, where <file_column> is the name of the column in the FITS file that is to be loaded into <colname>.', type=str) | ||
parser.add_argument('--cols-file', help='A file with two, whitespace delimited columns, <colname> <file_column>, having the same meaning as arguments to --cols', type=str) |
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 taken from the text importer as well. I think this line contains a tab, which will have to be converted to spaces.
except ValueError: | ||
dbname = fitsname = spec[0] | ||
if dbname not in table.dtype.names: | ||
raise Exception("Unknown column '%s' in table %s" % (dbname, args.table)) |
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.
There was a bug here previously, with dbname
incorrectly shortened to the non-existent variable name
.
I hate to ask this, but for consistency with the rest of the codebase (and to make the diff more readable) could you switch spaces back to tabs? There's a unix command PS: Which editor do you use? |
I use vim. It's kind of a pain to switch it to use tabs. As I'm making changes to the code base, I'm using |
I've been trying to make the diffs more readable by doing |
This pull request adds the ability to specify
--cols-file
withlsd-import fits
. It also fixes a bug that used to occur when a database column name was not recognized.I had to convert tabs to spaces in order to edit this file, because my text editor wouldn't allow me to write tabs, so that complicates reading the diff.