mhvk / baseband-tasks

A package for radio baseband data reduction and analysis.
https://baseband.readthedocs.io/projects/baseband-tasks
GNU General Public License v3.0
9 stars 11 forks source link

Read task out shape does not match PSRFITS data shape #121

Open luojing1211 opened 5 years ago

luojing1211 commented 5 years ago

In PR #119 I added the data writing functionality. The file handler shape is (nsample, nbin, npol, nchan), but the PSRFITS shape is (nsample, nbin, nchan, npol). So the

read(nsample, out = PSRFITS)

will report the bug of not the same shape. Where should the reshape happen?

mhvk commented 5 years ago

In your text above, the shapes are in fact the same... At long as nsample is first, I think the easiest route for now is somehing like:

reshape_to_fits = Reshape(result, <fits_shape>)
reshape_to_fits.read(nsample, out=...)

Maybe eventually we can adjust the Reshape task so that it works in front of a writer as well?

luojing1211 commented 5 years ago

I made a mistake on the file shape and I just fixed it. Do you mean, we can add reshape task as part of the writer? I think it will work.

mhvk commented 5 years ago

OK, now makes more sense. So, yes, we can already do the reshape pre-write, and I agree that we should be able to make it work on the writer as well. Given properly named sample_shape, it could even become automatic...

luojing1211 commented 5 years ago

To make it automatic, we should know the sample label from the upstream file hander. However, this information may be lost at some steps of the pipeline.

mhvk commented 5 years ago

Part of it we can infer from .frequency and .polarization, but it would be hard to do this reliably. Probably best for now to just stick with the Reshape option.