Open luojing1211 opened 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?
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.
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...
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.
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.
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
will report the bug of not the same shape. Where should the reshape happen?