Conversation
Updates `develop` for changes to `release` and bumps dev doc
Revert "Updates `develop` for changes to `release` and bumps dev doc"
Move key-binding descriptions from class docstring to `pypeit_show_1dspec` description
|
PS - This also includes all the changes to |
|
Tests pass The one unit test failure is because of the number of files in the |
| raise PypeItError(f'CODING ERROR: All {frametype} frames in group {calib_ID} ' | ||
| 'are not all associated with the same subset of calibration ' | ||
| 'groups; calib for the first file is ' | ||
| f'{fitstbl["calib"][indx][0]}.') | ||
| log_str = f'All {frametype} frames in group {calib_ID} ' | ||
| log_str += 'are not all associated with the same subset of calibration ' | ||
| log_str += 'groups; calib for the first file is ' | ||
| log_str += f'{fitstbl["calib"][indx][0]}.' | ||
| log.warning(log_str) |
There was a problem hiding this comment.
Is this a correct demotion from an error to a warning?
There was a problem hiding this comment.
This is actually part of the changes that are currently in the release branch. This line was causing problems for APF/Levy reductions, so Brad and I talked through just demoting it. We, as the developers, need to keep an eye out that this isn't getting tripped, though.
| def save_pickle(fname, obj): | ||
| """Save an object to a python pickle file | ||
|
|
||
| Parameters | ||
| ---------- | ||
| fname : :class:`str` | ||
| Filename | ||
| obj : :class:`object` | ||
| An object suitable for pickle serialization. | ||
| """ | ||
| if fname.split(".")[-1] != 'pkl': | ||
| fname += '.pkl' | ||
| with open(fname, 'wb') as f: | ||
| pickle.dump(obj, f, pickle.HIGHEST_PROTOCOL) | ||
| log.info('File saved: {0:s}'.format(fname)) | ||
|
|
||
|
|
||
| def load_pickle(fname): | ||
| """Load a python pickle file | ||
|
|
||
| Parameters | ||
| ---------- | ||
| fname : :class:`str` | ||
| Filename | ||
|
|
||
| Returns | ||
| ------- | ||
| :class:`object` | ||
| An object suitable for pickle serialization. | ||
| """ | ||
| log.info('Loading file: {0:s}'.format(fname)) | ||
| with open(fname, 'rb') as f: | ||
| return pickle.load(f) | ||
|
|
||
|
|
There was a problem hiding this comment.
gasp no more pickles???!?
Based on some playing around with pydeps, the goal of the PR is to avoid "cycles" (i.e., circular imports) in the repo. This led to three main changes:
pypeit/__init__.pyfile are moved into a newpypeit/pkgdirectory. This includes the logging code, the exceptions, and the cache system. Anything in this directory should only import from other modules in this directory, not from other modules in the repo.pypeit/spectrographs/__init__.py, we were polluting the namespace with a lot of cycles. This is cleaned up a bit here by moving these imports out ofpypeit/spectrographs/__init__.pyand instead defining the__all__list, and moving code frompypeit/spectrographs/__init__.pytopypeit/spectrographs/util.py.pypeit/spectrographs/__init__.pyis also done forpypeit/scripts/__init__.py.A minor thing was that I moved some functions from
pypeit/par/util.pytopypeit/utils.pybecause they're used outside ofpypeit/par.There are some associated doc updates and a lot of changes to imports.