astronomyk / SimCADO

Other
4 stars 5 forks source link

optics.get_filter_curve prints "file not found" even if it finds it. #37

Closed miguelverdugo closed 5 years ago

miguelverdugo commented 5 years ago

e.g. sim.optics.get_filter_curve("Ks")

The issue is caused by line 705> fname = find_file(filter_name) that prints that error, even if later get_filter_curve is able to find the file or raise an error if not.

it is possible to silence the message with contextlib but I'm unsure whether it's the proper solution.

oczoske commented 5 years ago

I would advocate using full file names (in this case TC_filter_Ks.dat) as required by find_file(). If we decide to continue supporting abbreviations, they should be resolved before calling find_file(). This would work if there is exactly one file per filter name within the instrument package that is used.

miguelverdugo commented 5 years ago

I agree, specially when filters come from heterogeneous sources, including user supplied. If we decide to follow this way, the lines after 705 in get_filter_curve are therefore redundant

On the other hand, specifying filters with fewer characters is certainly appreciated by the end-user.

oczoske commented 5 years ago

I misunderstood the original issue: find_file() prints a message when it does not find a file. This is superfluous and confusing in this case. It is now silenced by adding silent=True in the call within get_filter_curve().

astroleo commented 5 years ago

Although it's not related to the OP's issue, I would like to support using full file names. Hardly more effort to type and it is good to be as explicit as possible to avoid confusion.