Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
ProcessLAS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ross Gray VIP - Physics
ProcessLAS
Commits
fca08d0a
Commit
fca08d0a
authored
1 year ago
by
Ross Gray VIP - Physics
Browse files
Options
Downloads
Patches
Plain Diff
Adding the Gspec notebook
parent
a91b21d4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GSpec.py
+60
-0
60 additions, 0 deletions
GSpec.py
GspecAnalysis.ipynb
+290
-0
290 additions, 0 deletions
GspecAnalysis.ipynb
README.md
+4
-0
4 additions, 0 deletions
README.md
with
354 additions
and
0 deletions
GSpec.py
0 → 100644
+
60
−
0
View file @
fca08d0a
'''
------------------------------------------
Title: GSPEC
Creation Date: 16/02/2024
Author: R. Gray
Version: v1
%%%%% CODE DESCRIPTION [BEGINS]
Class to wrap up some of the basic analysis of the Gspec
%%%%% CODE DESCRIPTION [ENDS]
------------------------------------------
'''
from
PIL
import
Image
import
numpy
as
np
import
pandas
as
pd
class
GSpec
:
def
__init__
(
self
,
filename
,
maskfile
=
None
):
self
.
filename
=
filename
self
.
maskfile
=
maskfile
def
loadfile
(
self
):
im
=
Image
.
open
(
self
.
filename
)
return
im
def
get_mask
(
self
,
im
):
# Load the CSV file
df
=
pd
.
read_csv
(
self
.
maskfile
)
# Assuming the last row contains the rotation angle applied to all points
rotation_angle
=
df
.
iloc
[
-
1
][
'
Rotation_Angle
'
]
# Apply the rotation angle to the image
rotated_img
=
im
.
rotate
(
rotation_angle
,
expand
=
True
)
rotated_img
=
np
.
asarray
(
rotated_img
)
# Extract the coordinates from the DataFrame
coordinates
=
df
[[
'
X
'
,
'
Y
'
]].
to_numpy
()
# Exclude the last row used for angle
background_coords
=
np
.
copy
(
coordinates
)
background_coords
[:,
1
]
=
background_coords
[:,
1
]
-
350
return
rotated_img
,
coordinates
,
background_coords
\ No newline at end of file
This diff is collapsed.
Click to expand it.
GspecAnalysis.ipynb
0 → 100644
+
290
−
0
View file @
fca08d0a
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
README.md
+
4
−
0
View file @
fca08d0a
# GSpec Analysis
This notebook gives some example of doing the basic analysis on the Gspec. It also makes use of the GSpec.py analysis class which is included in this repository.
# GSpec Image Mask Definition
# GSpec Image Mask Definition
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment