Ejemplo n.º 1
0
def load_all_cached_profile_data(meta_dir: Path,
                                 glob_pattern: typing.Union[Path, str]):
    glob_pattern = str(glob_pattern)
    return xr.concat(
        (pio.load_profile_data(p)
         for p in sorted(meta_dir.glob(glob_pattern))),
        dim="animal",
    )
Ejemplo n.º 2
0
    def test_standardization(self, matlab_engine, shared_datadir):
        raw_data = pio.load_profile_data(
            shared_datadir / "experiments" / "2017_02_23-HD233_HD236" /
            "analyses" / "2020-05-22" /
            "2017_02_23-HD233_HD236-untrimmed_profile_data.nc").isel(
                animal=[0, 1, 2])

        std_data, std_warp = pp.standardize_profiles(
            raw_data,
            redox_params=self.redox_params,
            eng=matlab_engine,
            **self.reg_d2_parameters,
        )

        assert raw_data.animal.size == std_data.animal.size
Ejemplo n.º 3
0
    def test_channel_registration(self, matlab_engine, shared_datadir):
        raw_data = pio.load_profile_data(
            shared_datadir / "experiments" / "2017_02_23-HD233_HD236" /
            "analyses" / "2020-05-22" /
            "2017_02_23-HD233_HD236-untrimmed_profile_data.nc").isel(
                animal=[0, 1, 2])

        reg_data, warp_data = pp.channel_register(
            raw_data,
            redox_params=self.redox_params,
            eng=matlab_engine,
            reg_params=self.reg_d2_parameters,
        )

        assert raw_data.animal.size == reg_data.animal.size
Ejemplo n.º 4
0
 def load_masks(self):
     self.seg_images = pio.load_profile_data(self.seg_images_path)
     logging.info(f"Loaded masks from {self.seg_images_path}")
Ejemplo n.º 5
0
from pharedox import pio as pio
from pharedox import plots
from pharedox import profile_processing as pp
from pharedox import utils

logging.basicConfig(
    format="%(asctime)s %(levelname)s:%(message)s",
    level=logging.DEBUG,
    datefmt="%I:%M:%S",
)

meta_dir = Path("/Users/sean/code/pharedox/data/paired_ratio")

prof_raw = xr.concat(
    [
        pio.load_profile_data(x) for x in sorted(
            meta_dir.glob("**/2020-01-09_unregistered/*untrimmed*.nc"))
    ],
    dim="animal",
)
prof_raw = prof_raw.assign_coords(
    {"position": np.linspace(0, 1, prof_raw.position.size)})

rot_fl = xr.load_dataarray(
    "/Users/sean/code/pharedox/data/paired_ratio/all_rot_fl.nc").rename(
        {"spec": "animal"})
rot_seg = xr.load_dataarray(
    "/Users/sean/code/pharedox/data/paired_ratio/all_rot_seg.nc").rename(
        {"spec": "animal"})

midlines = ip.calculate_midlines(rot_seg)