The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum
 Origin Forum
 Despecke matrix

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AKazak Posted - 08/31/2021 : 10:25:39 AM
OriginPro 2022 (64-bit) Beta2 9.9.0.105
Windows 7 SP1 x64

Greetings!

I have a matrix object and need to replace all the speckles with the missing values. My current thought is to use Python in Set Values dialog.

What Python libraries are available in Origin to find speckles?
How do I set Matrix cells to missing from Python code?

Thank you.

---
Andrey
11   L A T E S T    R E P L I E S    (Newest First)
AKazak Posted - 09/08/2021 : 07:03:32 AM
quote:
Originally posted by easwar

Hi Andrey,

You can use the menu "Connectivity->Open Examples.py...". This will open the file in code builder and you will see list of supported types plus several examples.

Easwar



Thank you for the useful suggestion.

---
Andrey
easwar Posted - 09/04/2021 : 2:00:12 PM
Hi Andrey,

You can use the menu "Connectivity->Open Examples.py...". This will open the file in code builder and you will see list of supported types plus several examples.

Easwar
AKazak Posted - 09/04/2021 : 01:48:46 AM
quote:
Originally posted by easwar

Hi Andrey,

Please see:
https://www.originlab.com/doc/python/tools/Set-Column-Values#Specifying_Input_and_Output_Types

Easwar



OK, I see that this is a Python syntax.
Where for I find a complete list of types supported in docstring syntax, including F (float) and i (integer)?

---
Andrey
easwar Posted - 09/03/2021 : 08:35:07 AM
Hi Andrey,

Please see:
https://www.originlab.com/doc/python/tools/Set-Column-Values#Specifying_Input_and_Output_Types

Easwar
AKazak Posted - 09/03/2021 : 05:41:29 AM
quote:
Originally posted by easwar

Hi Andrey,

Here is a simple example where matrix object2 is set with flipped values from object 1.

Easwar
OriginLab




Dear Easwar,

I your example above, what does F:Fi stand for?

---
Andrey
easwar Posted - 09/02/2021 : 09:24:07 AM
Hi Andrey,

Here is a simple example where matrix object2 is set with flipped values from object 1.



Easwar
OriginLab
AKazak Posted - 09/01/2021 : 11:47:43 PM
Dear Easwar,

quote:
Originally posted by easwar
If you are using the "Python Packages" dialog to install a package (Origin menu: Connectivity->Python Packages), in that dialog, there is a check box named "Pause output window". If you check that, the command window will stay open for you to read the error messages.

To install scikit image, you need to install the package named:
scikit-image

Please try that and see if that succeeds.


Done!
Please consider implementing an automatic "Pause output window" in case of warnings or errors during installation.
Besides it would be useful if one could use just installed Python packages without restart of Origin.

quote:
Originally posted by easwar
In the upcoming 2022 version, we will have methods to get multiframe image from a new image window and process that in Python. I presume you are working with an image stack?



Currently, I have a matrix object to be processed and plan to use Set values... dialog to paste the Python code.

Can you share an example snippet on processing a data matrix object from the dialog, please?

---
Andrey
easwar Posted - 09/01/2021 : 4:04:08 PM
quote:

However, for some unknown reason, I cannot install skimage package.
Origin gives me a bunch of red lines and closes the console windows without a prompt.

Can you help me with this, please?

---
Andrey



Hi Andrey,

If you are using the "Python Packages" dialog to install a package (Origin menu: Connectivity->Python Packages), in that dialog, there is a check box named "Pause output window". If you check that, the command window will stay open for you to read the error messages.

To install scikit image, you need to install the package named:
scikit-image

Please try that and see if that succeeds.

In the upcoming 2022 version, we will have methods to get multiframe image from a new image window and process that in Python. I presume you are working with an image stack?

Easwar
OriginLab
AKazak Posted - 09/01/2021 : 2:09:16 PM
Here is the code I need to use:
from skimage.filters import rank
from skimage.morphology import disk, ball

def remove_outliers(image, radius=2, threshold=50):
    footprint_function = disk if image.ndim == 2 else ball
    footprint = footprint_function(radius=radius)
    median_filtered = rank.median(image, footprint)
    outliers = (
        (image > median_filtered + threshold)
        | (image < median_filtered - threshold)
    )
    output = np.where(outliers, median_filtered, image)
    return output


However, for some unknown reason, I cannot install skimage package.
Origin gives me a bunch of red lines and closes the console windows without a prompt.

Can you help me with this, please?

---
Andrey
AKazak Posted - 09/01/2021 : 1:53:32 PM
quote:
Originally posted by YimingChen

See example below to set missing values:

import numpy as np
import originpro as op

aa = np.array([	[1, np.nan, 3], [np.nan, 5, 6] ])
ma=op.new_sheet('m')
ma.from_np(aa)

You will need to find such Python package to handle the data in Python and then bring it into Origin.

James



OK.

How do I get a handle of the existing and currently selected matrix object in Python?

---
Andrey
YimingChen Posted - 09/01/2021 : 09:36:13 AM
See example below to set missing values:

import numpy as np
import originpro as op

aa = np.array([	[1, np.nan, 3], [np.nan, 5, 6] ])
ma=op.new_sheet('m')
ma.from_np(aa)

You will need to find such Python package to handle the data in Python and then bring it into Origin.

James

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000