-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add pystxm operations #1
Open
JulReinhardt
wants to merge
38
commits into
master
Choose a base branch
from
operations_pystxm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
60f24e0
Merge branch 'master' into operations_pystxm
JulReinhardt 35ee06f
fixing error messages
JulReinhardt 2bd543d
Merge branch 'ingestor_pystxm' into operations_pystxm
JulReinhardt 4ea26a1
Merge branch 'master' into operations_pystxm
JulReinhardt b3eb0ba
testing
JulReinhardt ee6a74a
back to working state
JulReinhardt 5fa3dd8
add operations
JulReinhardt ee2a3a5
change to pystxmtools package for import of operations
JulReinhardt 4d04629
add entry points for pystxm operations
JulReinhardt b296a7c
remove ingestor parts --> see different PR
JulReinhardt f9698d9
test example
JulReinhardt ae411b4
use apply signature and new imports of operation
JulReinhardt b11de62
adapt new decorator written pystxm operations
JulReinhardt 6b88e3c
modify imports for register_operation
JulReinhardt a2bb9c7
messing with the test
JulReinhardt 73f37db
messing with the test
JulReinhardt 9d22cd9
Merge remote-tracking branch 'origin/master' into operations_pystxm
JulReinhardt d651fb9
add vanessa's operations to entrypoints
JulReinhardt 45f423f
execute iterative false
JulReinhardt ade00d1
Merge branch 'master' into operations_pystxm
JulReinhardt d2752cd
get array data from image intent if projector return list
JulReinhardt 64a2367
Ron's suggestions
JulReinhardt 1af93be
get array data from Image Intent for workflow operation
JulReinhardt 48eb441
Merge branch 'master' into operations_pystxm
JulReinhardt d2b4891
Merge branch 'master' into operations_pystxm
JulReinhardt aa9065e
add decomposition pca to entry points
JulReinhardt bfcbbdb
add switch for energy axis being last or first axis
JulReinhardt 69e521d
formatting
JulReinhardt d668476
some fixes in projector and adding entry points for more operations
JulReinhardt bb8ab02
Merge branch 'master' into operations_pystxm
JulReinhardt 4ed29ef
add multiple intent display names for splitview
JulReinhardt be18c84
change decomposition to energy axis = first
JulReinhardt ffeb104
minors
JulReinhardt d979e23
Trim comments
ronpandolfi 6d521e6
remove entry points and more to pystxm-tools
JulReinhardt 744f969
Merge branch 'operations_pystxm' of https://github.com/Xi-CAM/Xi-cam.…
JulReinhardt 24d9963
remove extra logic, keep only energy stack data in projector
JulReinhardt bdb432d
list to project all
JulReinhardt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ build/ | |
dist/ | ||
*.egg-info/ | ||
venv/ | ||
.vscode |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import numpy as np | ||
import xarray as xr | ||
|
||
from databroker.in_memory import BlueskyInMemoryCatalog | ||
from qtpy.QtWidgets import QLabel, QComboBox, QHBoxLayout, QWidget, QSpacerItem, QSizePolicy | ||
|
||
|
@@ -16,9 +17,10 @@ | |
from xicam.gui.widgets.linearworkfloweditor import WorkflowEditor | ||
from databroker.core import BlueskyRun | ||
from xicam.core.execution import Workflow | ||
from xicam.core.intents import Intent | ||
from xicam.plugins import GUIPlugin | ||
from ..widgets.image_viewers import CatalogViewerBlend | ||
from ..projectors import project_nxSTXM, project_all | ||
from ..projectors import project_all | ||
|
||
|
||
class SpectralBase(GUIPlugin): | ||
|
@@ -42,10 +44,16 @@ def __init__(self): | |
super(SpectralBase, self).__init__() | ||
|
||
def treatment_kwargs(self, workflow): | ||
intent_name = ['hyperspectral_data', 'ptychography data', 'IR maps'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ronpandolfi what's the best way to attribute scientific meaning through intents? |
||
|
||
# FIXME: Putting this here for now... | ||
self.current_data = None | ||
return {'data': project_all(self.current_catalog)} | ||
projected_data = project_all(self.current_catalog) | ||
if isinstance(projected_data, list): | ||
data_intent = next(filter(lambda intent: intent.item_name in intent_name, iter(projected_data))) | ||
return {'data': data_intent.image} | ||
else: | ||
return {'data': projected_data} | ||
|
||
def append_treatment(self, result_set): | ||
if self.current_data is None: | ||
|
@@ -60,7 +68,7 @@ def appendCatalog(self, run_catalog: BlueskyRun, **kwargs): | |
# catalog.metadata.update(self.schema()) | ||
ensemble = Ensemble() | ||
ensemble.append_catalog(run_catalog) | ||
self.ensemble_model.add_ensemble(ensemble, project_all) | ||
self.ensemble_model.add_ensemble(ensemble, [project_all]) | ||
|
||
try: | ||
# Apply nxSTXM projection | ||
|
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
|
||
from shop.correction.register import RegisterOperation | ||
from shop.correction.filter import MedianFilterOperation, WienerFilterOperation | ||
from pystxmtools.corrections.register import register_operation | ||
from pystxmtools.corrections.filter import median_filter_operation, wiener_filter_operation, denoise_operation, despike_operation | ||
from pystxmtools.corrections.optical_density import calc_opt_density_operation | ||
from pystxmtools.corrections.fitting import lsq_fit_operation | ||
|
||
# from ..operations.register import RegisterOperation | ||
# from shop.correction.filter import median_filter, wiener_filter | ||
|
@@ -13,13 +15,22 @@ def __init__(self): | |
super(StxmWorkflow, self).__init__(name="STXM Workflow") | ||
|
||
# Create instances of operations | ||
register = RegisterOperation() | ||
wiener = MedianFilterOperation() | ||
median = WienerFilterOperation() | ||
register = register_operation() | ||
wiener = median_filter_operation() | ||
median = wiener_filter_operation() | ||
denoise = denoise_operation() | ||
#TODO: how can calcOD receive IO map in workflow editor | ||
calc_OD = calc_opt_density_operation() | ||
lstsq_fit = lsq_fit_operation() | ||
|
||
# Add operation to the workflow | ||
self.add_operations(register) | ||
self.add_operations(wiener) | ||
self.add_operations(median) | ||
self.add_operation(denoise) | ||
self.add_operation(calc_OD) | ||
self.add_operation(lstsq_fit) | ||
# self.auto_connect_all() | ||
#connect one operation's output with another operation's input | ||
# self.add_link() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add connections, move to Xi-CAM.STXM |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refer to nx tycho to see if we can put these reference energies in a different field (may have to extend the spec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heuristics, or acquisition-side definition of the reference energies
(just writing these comments for later notes - fine to keep this in for now)