Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into 143-limiting-magnitude
Browse files Browse the repository at this point in the history
  • Loading branch information
dryczanowski committed Jul 25, 2024
2 parents cd3d8f2 + 1d54209 commit ed52540
Show file tree
Hide file tree
Showing 16 changed files with 1,234 additions and 259 deletions.
458 changes: 458 additions & 0 deletions alembic/versions/2024_07_23_1518-d86b7dee2172_fourcorners_minmax.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ Note that in the devshell and test docker environments above, database migration

### Installing SeeChange on a local machine (not dockerized)

**WARNING:** This section is no longer complete. What's described here will get you partway there. However, the tests now require a number of external servers to be running, and setting all of them up is not documented here. The best way to get everything set up as necessary to run all of the code, and all of the tests, is to use a dockerized environment as described above.

As always, checkout the code from github: <https://github.com/c3-time-domain/SeeChange>.
We recommend using a virtual environment to install the dependencies. For example:

Expand All @@ -155,7 +157,7 @@ source venv/bin/activate
pip install -r requirements.txt
```

This covers the basic python dependencies.
This covers (most of) the basic python dependencies.

Install some of the standalone executables needed for
analyzing astronomical images:
Expand Down
20 changes: 10 additions & 10 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ of the pipeline are consistent with previous code versions.

### Running tests

To run the tests, simply run the following command from the root directory of the project:
If you are in an environment that has all of the SeeChange prerequisites, you can run the tests by simply running the following command from the root directory of the project:

```bash
pytest
```

To run the tests in a dockerized environment, see the setup.md file, under "Running tests".
The tests have a lot of infrastructure necessary to run, however. If you really know what you're doing, you may be able to set up the full environment. However, most users will find it easier to use the dockerized environment designed to run with our tests. See "Setting up a SeeChange instance" for more information.

### Test caching and data folders
### Testing tips

#### Files left over in database / archive / disk at end of tests

The tests are supposed to clean up after themselves, so at the end of a test run there should be nothing left in the database or on the archive. (There are some exceptions of things allowed to linger.) If things are found at the end of the tests, this will raise errors. Unfortunately, these errors can hide the real errors you had in your test (which may also be the reasons things were left behind!) When debugging, you often want to turn off the check that things are left over at the end, so you can see the real errors you're getting. Edit `tests/fixtures/conftest.py` and set the variable `verify_archive_database_empty` to `False`. (Remember to set it back to `True` before pushing your final commit for a PR, to re-enable the leftover file tests!)

#### Test caching and data folders

Some of our tests require large datasets (mostly images).
We include a few example images in the repo itself,
but most of the required data is lazy downloaded from
the appropriate servers (e.g., from Noirlab).

To avoid downloading the same data over and over again, we cache the
data in the `data/cache` folder. To make sure the downloading process
works as expected, users can choose to delete this folder. (One may also
need to delete the `tests/temp_data` folder, if tests were interrupted.
Ideally, the tests don't depend on anything specific in there, but there
may be things left behind.) In the tests, the path to this folder is
given by the `cache_dir` fixture.
To avoid downloading the same data over and over again, we cache the data in the `data/cache` folder. To make sure the downloading process works as expected, users can choose to delete this folder. Sometimes, also, tests may fail because things have changed, but there are older versions left behind in the cache; in this case, clearing out the cache directory will also solve the problem. (One may also need to delete the `tests/temp_data` folder, if tests were interrupted. Ideally, the tests don't depend on anything specific in there, but there may be things left behind.) In the tests, the path to this folder is given by the `cache_dir` fixture.

Note that the persistent data, that comes with the
repo, is anything else in the `data` folder,
Expand Down
10 changes: 9 additions & 1 deletion hacks/rknop/import_decam_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def import_decam_reference( image, weight, mask, target, hdu, section_id ):
dec_corner_11 = cdec
else:
raise RuntimeError( "This should never happen" )
minra = min( ra_corner_00, ra_corner_01 )
maxra = max( ra_corner_10, ra_corner_11 )
mindec = min( dec_corner_00, dec_corner_10 )
maxdec = max( dec_corner_01, dec_corner_11 )

image = Image( provenance=prov,
format='fits',
Expand All @@ -157,7 +161,11 @@ def import_decam_reference( image, weight, mask, target, hdu, section_id ):
dec_corner_00=dec_corner_00,
dec_corner_01=dec_corner_01,
dec_corner_10=dec_corner_10,
dec_corner_11=dec_corner_11 )
dec_corner_11=dec_corner_11,
minra=minra,
maxra=maxra,
mindec=mindec,
maxdec=maxdec )

image.header = img_hdr
image.data = img_data
Expand Down
Loading

0 comments on commit ed52540

Please sign in to comment.