diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fbc16ee..e06fb7d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,7 +73,7 @@ jobs: body_path: git_changes.log build-ubuntu-latest: - needs: [test] + needs: [release] runs-on: ubuntu-latest if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all", "linux", "all_incl_release"]'), github.event.inputs.build-items)) }} permissions: @@ -97,9 +97,6 @@ jobs: twine upload dist/* -u __token__ -p ${{ secrets.PYPI_TOKEN }} --skip-existing this_tag=$(python -c "import eos;print('v'+eos.__version__)") echo "RELEASE_TAG=$this_tag" >> $GITHUB_ENV - - name: Sleep 30s - run: | - sleep 30 - name: Update Release if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all_incl_release"]'), github.event.inputs.build-items)) }} uses: actions/gitea-release-action@v1 @@ -110,7 +107,7 @@ jobs: dist/amor*.tar.gz build-windows: - needs: [test] + needs: [release] runs-on: windows-latest if: ${{ (github.event_name != 'workflow_dispatch') || (contains(fromJson('["all", "windows", "all_incl_release"]'), github.event.inputs.build-items)) }} diff --git a/test_data/amor2026n003629.hdf b/test_data/amor2026n003629.hdf new file mode 100644 index 0000000..16f8d45 --- /dev/null +++ b/test_data/amor2026n003629.hdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee61f731ec7e635e3a2d567aa41d8bf873f3b70d3707c029681f72866e44fb0f +size 14133903 diff --git a/test_data/amor2026n003630.hdf b/test_data/amor2026n003630.hdf new file mode 100644 index 0000000..ebe6fee --- /dev/null +++ b/test_data/amor2026n003630.hdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:644e86e50a8aa822c67304e9132ad31548a493834ce31e9dab2cb45c6824ef7c +size 14133903 diff --git a/test_data/amor2026n003631.hdf b/test_data/amor2026n003631.hdf new file mode 100644 index 0000000..b294d69 --- /dev/null +++ b/test_data/amor2026n003631.hdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2d708c530167d227b5f3c9916714c5f5f78f270ebf915bf67cf6c84a9cc12d1f +size 17148559 diff --git a/tests/test_full_analysis_v2.py b/tests/test_full_analysis_v2.py new file mode 100644 index 0000000..dad29ce --- /dev/null +++ b/tests/test_full_analysis_v2.py @@ -0,0 +1,125 @@ +import os +import cProfile +import numpy as np +from unittest import TestCase +from dataclasses import fields, MISSING +from eos import options, reduction_reflectivity, logconfig +from orsopy import fileio + +logconfig.setup_logging() +logconfig.update_loglevel(1) + +# TODO: add unit tests for individual parts of reduction + +class FullAmorTest(TestCase): + @classmethod + def setUpClass(cls): + # generate map for option defaults + cls._field_defaults = {} + for opt in [options.ExperimentConfig, options.ReflectivityReductionConfig, options.ReflectivityOutputConfig]: + defaults = {} + for field in fields(opt): + if field.default not in [None, MISSING]: + defaults[field.name] = field.default + elif field.default_factory not in [None, MISSING]: + defaults[field.name] = field.default_factory() + cls._field_defaults[opt.__name__] = defaults + cls.pr = cProfile.Profile() + + @classmethod + def tearDownClass(cls): + cls.pr.dump_stats("profile_test.prof") + + def setUp(self): + self.pr.enable() + self.reader_config = options.ReaderConfig( + year=2026, + rawPath=["test_data"], + ) + + def tearDown(self): + self.pr.disable() + for fi in ['test_results/test.Rqz.ort', 'test_results/5952.norm']: + try: + os.unlink(fi) + except FileNotFoundError: + pass + + def test_time_slicing(self): + experiment_config = options.ExperimentConfig( + yRange=(18, 48), + lambdaRange=(3., 11.5), + sampleModel='air | 10 H2O | D2O' + ) + reduction_config = options.ReflectivityReductionConfig( + qResolution=0.01, + qzRange=(0.01, 0.15), + thetaRange=(-0.75, 0.75), + fileIdentifier=["3629", "3630"], + scale=[1], + normalisationFileIdentifier=[], + timeSlize=[300.0] + ) + output_config = options.ReflectivityOutputConfig( + outputFormats=[options.OutputFomatOption.Rqz_ort], + outputName='test', + outputPath='test_results', + ) + config=options.ReflectivityConfig(self.reader_config, experiment_config, reduction_config, output_config) + # run three times to get similar timing to noslicing runs + reducer = reduction_reflectivity.ReflectivityReduction(config) + reducer.reduce() + reducer = reduction_reflectivity.ReflectivityReduction(config) + reducer.reduce() + reducer = reduction_reflectivity.ReflectivityReduction(config) + reducer.reduce() + + def test_noslicing(self): + experiment_config = options.ExperimentConfig( + yRange=(18, 48), + lambdaRange=(3., 11.5), + ) + reduction_config = options.ReflectivityReductionConfig( + qResolution=0.01, + thetaRange=(-0.75, 0.75), + fileIdentifier=["3629", "3630"], + scale=[1], + normalisationFileIdentifier=["3631"], + autoscale=(0.0, 0.05), + ) + output_config = options.ReflectivityOutputConfig( + outputFormats=[options.OutputFomatOption.Rqz_ort], + outputName='test', + outputPath='test_results', + ) + config=options.ReflectivityConfig(self.reader_config, experiment_config, reduction_config, output_config) + reducer = reduction_reflectivity.ReflectivityReduction(config) + reducer.reduce() + # run second time to reuse norm file + reducer = reduction_reflectivity.ReflectivityReduction(config) + reducer.reduce() + + def test_noslicing_nmon(self): + experiment_config = options.ExperimentConfig( + yRange=(18, 48), + lambdaRange=(3., 11.5), + ) + reduction_config = options.ReflectivityReductionConfig( + qResolution=0.01, + thetaRange=(-0.75, 0.75), + fileIdentifier=["3629", "3630"], + scale=[1], + normalisationFileIdentifier=["3631"], + autoscale=(0.0, 0.05), + ) + output_config = options.ReflectivityOutputConfig( + outputFormats=[options.OutputFomatOption.Rqz_ort], + outputName='test', + outputPath='test_results', + ) + config=options.ReflectivityConfig(self.reader_config, experiment_config, reduction_config, output_config) + reducer = reduction_reflectivity.ReflectivityReduction(config) + reducer.reduce() + # run second time to reuse norm file + reducer = reduction_reflectivity.ReflectivityReduction(config) + reducer.reduce()