Unverified Commit 98215c31 authored by jlaura's avatar jlaura Committed by GitHub
Browse files

Updates minor bugs in jig update and affine transform (#590)

* Updates minor bugs in jig update and affine transform

* Updates changelog and bumps bug version

* updates to use CI for version bumping
parent bdc3c99c
Loading
Loading
Loading
Loading
+66 −0
Original line number Diff line number Diff line
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
+6 −0
Original line number Diff line number Diff line
@@ -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
+2 −2
Original line number Diff line number Diff line
@@ -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
+9 −8
Original line number Diff line number Diff line
@@ -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,6 +174,7 @@ 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)

    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)

+1 −1
Original line number Diff line number Diff line
@@ -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:
Loading