Commit 1ad6d804 authored by Anika Treffehn's avatar Anika Treffehn
Browse files

changed position of file exists check

parent 5bffa9d0
Loading
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -158,17 +158,12 @@ class TestConfig:
                    "Only prerecorded or low level background noise possible, not both"
                )

            # check if path of background noise exists or is in input folder
            if bg_noise.get("background_noise_path", None):
                # check snr
                if not bg_noise.get("snr", None):
                    raise ValueError("SNR has to be specified for background noise")

                if not get_abs_path(bg_noise["background_noise_path"]).exists():
                    raise ValueError(
                        f"Background noise path {bg_noise['background_noise_path']} does not exist"
                    )

                # check if path of background noise is in input folder
                bg_noise_folder = Path(bg_noise["background_noise_path"]).parent
                if get_abs_path(bg_noise_folder) == get_abs_path(cfg["input_path"]):
                    raise ValueError(
+4 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ class Preprocessing2(Processing):
        max_delay = int(2400000 * audio_object.fs / 48000)

        if self.background_noise.get("background_noise_path"):
            if not self.background_noise.get("background_noise_path").exists():
                raise ValueError(
                    f"Background noise path {self.background_noise.get('background_noise_path')} does not exist"
                )
            # load background noise
            if self.background_noise["background_object"] is not None:
                noise_object = self.background_noise["background_object"]