dlilien / ImpDAR

An impulse radar processor
GNU General Public License v3.0
27 stars 19 forks source link

Update load_bsi.py #45

Closed EmmaErwin93 closed 1 year ago

EmmaErwin93 commented 1 year ago

Updated for new variable names acquired with BSI update (Applied for UMAINE radar in spring 2023)

codecov[bot] commented 1 year ago

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (adfca68) 79.74% compared to head (27f5831) 79.73%.

:exclamation: Current head 27f5831 differs from pull request most recent head 9eaa658. Consider uploading reports for the commit 9eaa658 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #45 +/- ## ========================================== - Coverage 79.74% 79.73% -0.01% ========================================== Files 61 61 Lines 6918 6915 -3 ========================================== - Hits 5517 5514 -3 Misses 1401 1401 ``` | [Files](https://app.codecov.io/gh/dlilien/ImpDAR/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=David+Lilien) | Coverage Δ | | |---|---|---| | [impdar/lib/load/load\_bsi.py](https://app.codecov.io/gh/dlilien/ImpDAR/pull/45?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=David+Lilien#diff-aW1wZGFyL2xpYi9sb2FkL2xvYWRfYnNpLnB5) | `76.77% <88.23%> (-0.45%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dlilien commented 1 year ago

@EmmaErwin93 I modified this so that it hopfully works simultaneously with old and new BSI data. I have confirmed that it works with old data again. Can you check that this version works with your new BSI data? I think you just need to git pull your fork to get my changes.

EmmaErwin93 commented 1 year ago

@dlilien Just tried, but get an error:

Loading LabVIEW Boolean from raw/Eclipse-P2/eclipse-phase2.h5 Loading line_0 from raw/Eclipse-P2/eclipse-phase2.h5 Interpolating traces with bad GPS in line_0 Traceback (most recent call last): File "/Users/emmaerwin/opt/miniconda3/bin/impdar", line 33, in sys.exit(load_entry_point('impdar', 'console_scripts', 'impdar')()) File "/Users/emmaerwin/software/ImpDAR/impdar/bin/impdarexec.py", line 182, in main return args.func(*vars(args)) File "/Users/emmaerwin/software/ImpDAR/impdar/lib/load/init.py", line 196, in load_and_exit rd_list = load(filetype, fn_i, channel=channel, t_srs=t_srs, s_srs=s_srs, args, **kwargs) File "/Users/emmaerwin/software/ImpDAR/impdar/lib/load/init.py", line 92, in load data_nestedlist = [load_bsi.load_bsi(fn, nans=nans) for fn in fns_in] File "/Users/emmaerwin/software/ImpDAR/impdar/lib/load/init.py", line 92, in data_nestedlist = [load_bsi.load_bsi(fn, nans=nans) for fn in fns_in] File "/Users/emmaerwin/software/ImpDAR/impdar/lib/load/load_bsi.py", line 180, in load_bsi time = interp1d(h5_data.trace_num[mask], File "/Users/emmaerwin/opt/miniconda3/lib/python3.9/site-packages/scipy-1.9.3-py3.9-macosx-10.9-x86_64.egg/scipy/interpolate/_interpolate.py", line 484, in init self._y = self._reshape_yi(self.y) File "/Users/emmaerwin/opt/miniconda3/lib/python3.9/site-packages/scipy-1.9.3-py3.9-macosx-10.9-x86_64.egg/scipy/interpolate/_polyint.py", line 110, in _reshape_yi return yi.reshape((yi.shape[0], -1)) ValueError: cannot reshape array of size 0 into shape (0,newaxis)

dlilien commented 1 year ago

Ok, @EmmaErwin93 can you send me a file that is failing to load (or if you figured it out then just push the fix)? Sorry that this is complicated, but I know people are using ImpDAR with both old and new versions of BSI systems, so we need to provide some kind of solution that works for both.

dlilien commented 1 year ago

This should be compatible with both versions now. @EmmaErwin93 let me know if there are any lingering problems.

EmmaErwin93 commented 7 months ago

@dlilien I think there is an error in line 163 of the load_bsi.py file: _xmlGetVal(digitizer_data, sample_rate_str) or 1.0)

should not have the "or 1.0" at the end -- I think i accidentally hard coded this for a test file I was doing, but it affects the time vector for any file that the sample_rate_str is not read in.

I think that sample_rate_str in line 103 needs to have a space in front: ' Sample Rate'