Skip to content
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

Getting J plot and RJ plot classification #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ An example script is provided which shows how to use the package. It calculates
* 3 - Elongated, centrally over-dense,
* 4 - Elongated, centrally under-dense.

The J plot classification referes to the following shapes:
* 0 - Bubbles
* 1 - Filaments
* 2 - Cores

## Acknowledgements
This code was produced with the support of the Ministry of Science and Technology (MoST) in Taiwan through grant MoST 108-2112-M-001-004-MY2
## Contact

For up-to-date contact information see my [website](https://seamusclarke.github.io/#five)
For up-to-date contact information see my [website](https://seamusclarke.github.io/#five)
35 changes: 35 additions & 0 deletions RJplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
### The following are outward facing functions which may be called

### The main function of the package, returns the RJ-values of a 2D image (2d-array) as well as the classification of the structure.




def get_rj(image):

J1,J2,com,theta = moments(image)
Expand All @@ -17,6 +21,37 @@ def get_rj(image):

return RJ1,RJ2,cla


### get_class_j_rj and J_class functions are added by Kartik Neralwar. These give the j plot class and the rj plot class for a structure
def get_class_j_rj(image):

J1,J2,com,theta = moments(image)

RJ1 = (J1 - J2)/np.sqrt(2)
RJ2 = (J1 + J2)/np.sqrt(2)
RJ2 = RJ2/(-RJ1 + np.sqrt(2))

cla = classification(RJ1,RJ2)
J_cla = J_class(J1, J2)
return J_cla, cla

### J plot class as defined in Neralwar + 2022
### 0 - Bubble
### 1 - Filament
### 2 - Core
def J_class(J1, J2):
if(J1<0 and J2<0):
struc_1 = 0
if(J1>0 and J2<0):
struc_1 = 1
if(J1>0 and J2>0):
struc_1 = 2
else:
struc_1 = 3
return struc_1



### Uses the classification scheme described in the accompanying paper.
### 1 - Quasi-circular, centrally over-dense
### 2 - Quasi-circular, centrally under-dense
Expand Down