Skip to content
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

Capture compression and open binary if present. #419

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

delucchi-cmu
Copy link
Contributor

@delucchi-cmu delucchi-cmu commented Nov 14, 2024

The compression kwarg, when provided, should be used when opening the file, but should NOT be passed along to pandas.read_csv. This captures the value in a named argument so it can be used in the file opening.

Further, if some compression is provided, we change the read mode to "rb", as compression implies that the underlying file is not plain text.

Closes #407
Closes astronomy-commons/hats-import#425

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.02%. Comparing base (17ec4ac) to head (b3c1d38).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #419      +/-   ##
==========================================
+ Coverage   92.99%   93.02%   +0.03%     
==========================================
  Files          49       47       -2     
  Lines        2127     2123       -4     
==========================================
- Hits         1978     1975       -3     
+ Misses        149      148       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Nov 14, 2024

Before [e47eab1] After [9c40ded] Ratio Benchmark (Parameter)
12.7±0.2ms 15.0±1ms ~1.18 benchmarks.Suite.time_inner_pixel_alignment
385±2ms 389±5ms 1.01 benchmarks.Suite.time_outer_pixel_alignment
124±0.6ms 125±1ms 1.01 benchmarks.time_test_alignment_even_sky
1.04±0.02ms 1.03±0.02ms 0.99 benchmarks.time_test_cone_filter_multiple_order
46.3±0.6ms 45.3±0.4ms 0.98 benchmarks.Suite.time_pixel_tree_creation
117±0.9ms 111±0.6ms 0.95 benchmarks.Suite.time_paths_creation
97.9±0.5ms 92.1±0.6ms 0.94 benchmarks.MetadataSuite.time_load_partition_info_order7
98.4±0.6ms 92.5±0.5ms 0.94 benchmarks.MetadataSuite.time_load_partition_join_info
23.9±0.4ms 22.1±0.2ms 0.92 benchmarks.MetadataSuite.time_load_partition_info_order6

Click here to view all benchmarks.

Copy link
Contributor

@hombit hombit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I have few questions

  1. I don't really understand where decompression is happening - could you point on that code?
  2. Could you please add a high-level test for this?

src/hats/io/file_io/file_io.py Outdated Show resolved Hide resolved
@delucchi-cmu delucchi-cmu merged commit c27133d into main Nov 14, 2024
11 checks passed
@delucchi-cmu delucchi-cmu deleted the issue/407/open_mode branch November 14, 2024 16:34
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.

Open files with "b" flag Warnings with zipped CSV
2 participants