Skip to content

Conversation

@kamilansri
Copy link

Description

This PR fixes critical issues in the file classification debug script: syntax errors caused by some characters and logic errors in the pattern matching algorithm that led to misclassification of data products.

Changes

Logic Improvements

  • Implemented fnmatch: Replaced the manual string hacking logic (removing * and checking for substrings) with Python's built-in fnmatch library.
    • Issue: Previously, removing * and .fits from *.fits resulted in an empty string, causing the logic to return True for every file.
    • Fix: Glob patterns are now strictly respected.
  • Corrected Specificity Order: Reordered the pattern_order list to ensure more specific patterns are checked first.
    • Issue: src was previously checked before deepCoadd_src. Because deepCoadd_src contains the substring src, these files were being misclassified.
    • Fix: deepCoadd_src is now checked before generic src patterns.

Testing

  • Verified that deepCoadd_src files are no longer misclassified as src.
  • Verified that raw files are correctly identified via the fallback logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant