-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added findfeaturesSegment script (#5091)
* added findfeaturesSegment script * now parrallelized * updated logging code * added help string * added help string * added envs and fixed progress bar output * staging things * added python stuff, fixed segment issues, addressed coments * addressing comments * added more doc strings * made pybindings on by default * addressing comments * fixed some things, local testing * updated install steps * added basic tests * reverting ale pin * changed license * turn on pybindings in jenkins * renamed script * shadow rename?
- Loading branch information
Showing
22 changed files
with
2,236 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
# Setup for SWIG | ||
set(CMAKE_SWIG_FLAGS) | ||
find_package(SWIG REQUIRED) | ||
include(UseSWIG) | ||
list(APPEND CMAKE_SWIG_FLAGS "-py3;-DPY3") | ||
|
||
message(STATUS "SWIG flags: " ${CMAKE_SWIG_FLAGS} ) | ||
|
||
# Setup for Python linking | ||
find_package(Python3 REQUIRED COMPONENTS Interpreter Development) | ||
|
||
# Setup for wrapper library | ||
set(ASTROSET_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/astroset") | ||
set(ASTROSET_SOURCES astroset.i | ||
UserInterface.i | ||
) | ||
|
||
set(ASTROSET_APPS apps/) | ||
|
||
set_source_files_properties(${ASTROSET_SOURCES} PROPERTIES CPLUSPLUS ON) | ||
swig_add_library(astroset | ||
LANGUAGE python | ||
SOURCES ${ASTROSET_SOURCES} | ||
OUTPUT_DIR ${ASTROSET_OUTPUT_DIR}) | ||
swig_link_libraries(astroset isis Python3::Module) | ||
set_target_properties(astroset PROPERTIES SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE) | ||
set_target_properties(astroset PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${ASTROSET_OUTPUT_DIR}) | ||
|
||
# Create the files to install the Python wrapper | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in | ||
${CMAKE_CURRENT_BINARY_DIR}/setup.py) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py | ||
${ASTROSET_OUTPUT_DIR}/__init__.py | ||
COPYONLY) | ||
|
||
file(COPY ${ASTROSET_APPS} | ||
DESTINATION | ||
${ASTROSET_OUTPUT_DIR}/apps/) | ||
|
||
set(ASTROSET_APP_XML_FILES "apps/findFeaturesSegment/findFeaturesSegment.xml") | ||
file(COPY ${ASTROSET_APP_XML_FILES} DESTINATION ${CMAKE_BINARY_DIR}/bin/xml/ ) | ||
install(FILES ${ASTROSET_APP_XML_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/xml/) | ||
|
||
# Setup to run setup tools on install | ||
install(CODE "execute_process(COMMAND $ENV{CONDA_PREFIX}/bin/pip install ${CMAKE_CURRENT_BINARY_DIR}/ --prefix=${CMAKE_INSTALL_PREFIX} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
%module(package="astroset") UserInterface | ||
|
||
|
||
%{ | ||
#include "Gui.h" | ||
#include "Pvl.h" | ||
#include "UserInterface.h" | ||
%} | ||
|
||
%include <QVector> | ||
%include <QString> | ||
|
||
// Rename the constructors to Python-friendly names | ||
%rename(UserInterfaceFromArgsv) UserInterface(const QString &xmlfile, int &argc, char *argv[]); | ||
%rename(UserInterfaceFromList) UserInterface(const QString &xmlfile, QVector<QString> &args); | ||
|
||
%rename(GetFileName) IsisAml::GetFileName(QString const &) const; | ||
%rename(GetFileNameWithExt) IsisAml::GetFileName(QString const &, QString) const; | ||
%rename(GetFileNames) IsisAml::GetFileName(QString const &, std::vector<QString> &) const; | ||
|
||
%rename(GetAsString) IsisAml::GetAsString(QString const &) const; | ||
%rename(GetAsStrings) IsisAml::GetAsString(QString const &, std::vector<QString> &) const; | ||
|
||
%rename(GetString) IsisAml::GetString(QString const &) const; | ||
%rename(GetStrings) IsisAml::GetString(QString const &, std::vector<QString> &) const; | ||
|
||
%rename(GetCubeNameWithExt) IsisAml::GetCubeName(QString const &,QString) const; | ||
%rename(GetCubeName) IsisAml::GetCubeName(QString const &) const; | ||
|
||
%rename(GetInteger) IsisAml::GetInteger(const QString &) const; | ||
%rename(GetIntegers) IsisAml::GetInteger(const QString &, std::vector<int> &) const; | ||
|
||
%rename(GetDouble) IsisAml::GetDouble(const QString &) const; | ||
%rename(GetDoubles) IsisAml::GetDouble(const QString &, std::vector<int> &) const; | ||
|
||
%rename(GetBoolean) IsisAml::GetBoolean(const QString &) const; | ||
%rename(GetBooleans) IsisAml::GetBoolean(const QString &, std::vector<bool> &) const; | ||
|
||
%include "Pvl.h" | ||
%include "IsisAml.h" | ||
%include "UserInterface.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from .astroset import * | ||
|
||
from pathlib import Path | ||
import os | ||
|
||
try: | ||
ISISROOT = Path(os.environ["ISISROOT"]) | ||
except KeyError: | ||
raise EnvironmentError("Please set ISISROOT before importing anything") | ||
|
||
def init_application(args): | ||
appname = os.path.basename(args[0]) | ||
args = args[1:] | ||
|
||
xmlpath = Path(appname).with_suffix(".xml") | ||
if not xmlpath.exists() or not xmlpath.is_file(): | ||
xmlpath = ISISROOT / "bin" / "xml" / xmlpath | ||
print(xmlpath) | ||
if not xmlpath.exists(): | ||
raise FileExistsError(f"{appname} does not have an XML file") | ||
|
||
return UserInterfaceFromList(str(xmlpath), args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import findFeaturesSegment |
Empty file.
Oops, something went wrong.