diff --git a/.github/workflows/version_bump.yml b/.github/workflows/version_bump.yml new file mode 100644 index 0000000000000000000000000000000000000000..b7017ec821c8fb0618f48c824e64d754887a1576 --- /dev/null +++ b/.github/workflows/version_bump.yml @@ -0,0 +1,66 @@ +name: Autobump + +on: + pull_request: + types: [closed] + +jobs: + label-version-bump: + runs-on: ubuntu-latest + if: | + github.event.pull_request.merged + && ( + contains(github.event.pull_request.labels.*.name, 'bump patch') + || contains(github.event.pull_request.labels.*.name, 'bump minor') + || contains(github.event.pull_request.labels.*.name, 'bump major') + ) + steps: + - name: Check out the repository + uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.base.ref }} + + - name: Detect version bump type + id: bump-type + run: | + BUMP_TYPE=null + if [[ $BUMP_PATCH_PRESENT == 'true' ]]; then + BUMP_TYPE=patch + fi + if [[ $BUMP_MINOR_PRESENT == 'true' ]]; then + BUMP_TYPE=minor + fi + if [[ $BUMP_MAJOR_PRESENT == 'true' ]]; then + BUMP_TYPE=major + fi + echo "::set-output name=bump-type::$BUMP_TYPE" + env: + BUMP_PATCH_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'bump patch') }} + BUMP_MINOR_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'bump minor') }} + BUMP_MAJOR_PRESENT: ${{ contains(github.event.pull_request.labels.*.name, 'bump major') }} + + - name: Determine new version + id: new-version + if: steps.bump-type.outputs.bump-type != 'null' + run: | + CURRENT_VERSION='python setup.py --version' + if ${BUMP_TYPE} == 'major' + then + NEW_VERSION=`IFS='.' read -ra SPLITVER <<< "$VERSION"; echo $(("${SPLITVER[0]}"+1))."${SPLITVER[1]}"."${SPLITVER[2]}";` + elif ${BUMP_TYPE} == 'minor' + NEW_VERSION=`IFS='.' read -ra SPLITVER <<< "$VERSION"; echo "${SPLITVER[0]}".$(("${SPLITVER[1]}"+1))."${SPLITVER[2]}";` + elif ${BUMP_TYPE} == 'patch' + NEW_VERSION=`IFS='.' read -ra SPLITVER <<< "$VERSION"; echo "${SPLITVER[0]}"."${SPLITVER[1]}".$(("${SPLITVER[2]}"+1));` + fi + - name: Update version in setup.py + if: steps.bump-type.outputs.bump-type != 'null' + run: sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g" setup.py + - name: Update version in meta.yaml + if: steps.bump-type.outputs.bump-type != 'null' + run: sed -i "s/$CURRENT_VERSION/$NEW_VERSION/g" conda/meta.yaml + - name: Commit bump + if: steps.bump-type.outputs.bump-type != 'null' + uses: EndBug/add-and-commit@v7 + with: + branch: ${{ github.event.pull_request.base.ref }} + message: 'Bump version to ${{ steps.new-version.outputs.new-version }}' \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e00f872f31f964c7370260ada1b55df868931f3..c7394a6119a8f6be1f11502f18e575e86adedd8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,12 @@ release. ### Added - Added a mutual information matcher [#559](https://github.com/USGS-Astrogeology/autocnet/pull/559) +### Changed +- `geom_match_simple` defaults to a 3rd order warp for interpolation + +### Fixed +- `update_from_jigsaw` failures due to stale code. Now uses a conntext on the engine to ensure closure + ## [0.6.0] ### Added diff --git a/autocnet/graph/network.py b/autocnet/graph/network.py index 1c19e19edc22b7f48f62e53200d0600a9e2f8209..d29c9b4647ad28f804d742fd3cd54a1b2d113518 100644 --- a/autocnet/graph/network.py +++ b/autocnet/graph/network.py @@ -1938,8 +1938,8 @@ class NetworkCandidateGraph(CandidateGraph): """ isis_network = cnet.from_isis(path) io_controlnetwork.update_from_jigsaw(isis_network, - ncg.measures, - ncg.connection, + self.measures, + self.engine, pointid_func=pointid_func) @classmethod diff --git a/autocnet/io/db/controlnetwork.py b/autocnet/io/db/controlnetwork.py index 96a59cb30352e1d3fdc02aeeb5cbe017382e2f06..8282a67730d513a2f903dcf86583790175b75f23 100644 --- a/autocnet/io/db/controlnetwork.py +++ b/autocnet/io/db/controlnetwork.py @@ -98,7 +98,7 @@ ORDER BY measures."pointid", measures."id"; return df -def update_from_jigsaw(cnet, measures, connection, pointid_func=None): +def update_from_jigsaw(cnet, measures, engine, pointid_func=None): """ Updates a database fields: liner, sampler, measureJigsawRejected, samplesigma, and linesigma using an ISIS control network. @@ -120,8 +120,8 @@ def update_from_jigsaw(cnet, measures, connection, pointid_func=None): measures : pd.DataFrame of measures from a database table. - connection : object - An SQLAlchemy DB connection object + engine : object + An SQLAlchemy DB engine object poitid_func : callable A callable function that is used to split the id string in @@ -174,12 +174,13 @@ def update_from_jigsaw(cnet, measures, connection, pointid_func=None): # Compute the residual from the components measures['residual'] = np.sqrt(measures['liner'] ** 2 + measures['sampler'] ** 2) - # Execute an SQL COPY from a CSV buffer into the DB - measures.to_sql('measures_tmp', connection, schema='public', if_exists='replace', index=False, method=copy_from_method) + with engine.connect() as connection: + # Execute an SQL COPY from a CSV buffer into the DB + measures.to_sql('measures_tmp', connection, schema='public', if_exists='replace', index=False, method=copy_from_method) - # Drop the old measures table and then rename the tmp measures table to be the 'new' measures table - connection.execute('DROP TABLE measures;') - connection.execute('ALTER TABLE measures_tmp RENAME TO measures;') + # Drop the old measures table and then rename the tmp measures table to be the 'new' measures table + connection.execute('DROP TABLE measures;') + connection.execute('ALTER TABLE measures_tmp RENAME TO measures;') # This is not a permanent placement for this function # TO DO: create a new module for parsing/cleaning points from a controlnetwork diff --git a/autocnet/matcher/subpixel.py b/autocnet/matcher/subpixel.py index 1a362d1375e08eff7db2d7806bc4d1c4f7c0dcef..3f8e1a4b1060ed2d86c12f332e9333fe1d7bfa92 100644 --- a/autocnet/matcher/subpixel.py +++ b/autocnet/matcher/subpixel.py @@ -922,7 +922,7 @@ def geom_match_simple(base_cube, box = (0, 0, max(dst_arr.shape[1], base_arr.shape[1]), max(dst_arr.shape[0], base_arr.shape[0])) dst_arr = np.array(Image.fromarray(dst_arr).crop(box)) - dst_arr = tf.warp(dst_arr, affine) + dst_arr = tf.warp(dst_arr, affine, order=3) t3 = time.time() print(f'Affine warp took {t3-t2} seconds.') if verbose: diff --git a/conda/meta.yaml b/conda/meta.yaml index 92422458b140fcfe731046b974a2d8842fa37d93..eabb392ff5a5c6a625e7f2c5c6affab914e152d2 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,6 +1,6 @@ package: name: autocnet - version: 0.6 + version: 0.6.1 channels: - conda-forge diff --git a/setup.py b/setup.py index 06697bfe16e68761cc62fca19649d55ccfb96844..09f30d4136473f66a7c36927f3f7aa4382b3564f 100755 --- a/setup.py +++ b/setup.py @@ -1,39 +1,25 @@ import os from setuptools import setup, find_packages -import autocnet -from glob import glob - -from autocnet.examples import available #Grab the README.md for the long description with open('README.md', 'r') as f: long_description = f.read() -def setup_package(): - examples = set() - for i in available(): - if not os.path.isdir('autocnet/examples/' + i): - if '.' in i: - glob_name = 'examples/*.' + i.split('.')[-1] - else: - glob_name = 'examples/' + i - else: - glob_name = 'examples/' + i + '/*' - examples.add(glob_name) +__version__ = '0.6.1' +def setup_package(): setup( name = "autocnet", - version = '0.6.0', + version = __version__, author = "Jay Laura", author_email = "jlaura@usgs.gov", - description = ("I/O API to support planetary data formats."), + description = ("Automated control network generation."), long_description = long_description, license = "Public Domain", keywords = "Multi-image correspondence detection", url = "http://packages.python.org/autocnet", packages=find_packages(), include_package_data=True, - package_data={'autocnet' : list(examples)}, zip_safe=False, install_requires=[], classifiers=[