Exemple #1
0
def raw_to_fits(
    rawfile: os.PathLike,
    outfile: os.PathLike,
    overwrite: bool = False,
    header: bool = None,
    n_channels: int = 2048,
    fmt: np.dtype = ">i8",
    order: str = "F",
) -> None:
    """Create .fits from .raw file."""
    data = raw_to_df(rawfile, n_channels, fmt, order)
    df_to_fits(data, outfile, overwrite, header)

    return
Exemple #2
0
    def test_raw_to_df(
        self,
        df_and_buff: callable,
        fmt: str,
        shape: tuple,
        top: int,
        order: str,
    ):
        """Test for reading mock raw files to dataframe conversion."""

        original, buff_raw = df_and_buff(fmt=fmt,
                                         shape=shape,
                                         top=top,
                                         order=order,
                                         seed=42)
        result = raw_to_df(buff_raw, n_channels=shape[0], fmt=fmt, order=order)

        pd.testing.assert_frame_equal(original, result)
Exemple #3
0
    def test_raw_to_df_wrong_path(self, wrong_path: str):
        """Test for wrong raw path at dataframe conversion."""

        with pytest.raises(FileNotFoundError):
            raw_to_df(wrong_path)
Exemple #4
0
    def test_raw_to_df_wrong_input(self, data: any):
        """Test for wrong input at dataframe conversion."""

        with pytest.raises(OSError):
            raw_to_df(data)
Exemple #5
0
    def test_raw_to_df_template(self):
        """Test for reading template raw file to dataframe conversion."""
        original = datasets.load_csv_test()
        result = raw_to_df(rawpath)

        pd.testing.assert_frame_equal(original, result)