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

enhance pixel_plot #21

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

enhance pixel_plot #21

wants to merge 21 commits into from

Conversation

nicHoch
Copy link

@nicHoch nicHoch commented Jul 2, 2021

provide different chart types for BSD pixel data

kind: 'pixels' plots all detectors and all pixel as colormap

image

kind: 'errorbar' plots all detectors and pixelsrows as line chart with errorbars

Figure_1

kind: 'config' plots the static config of all detectors (pitch, orientation ...)

Figure_2

@samaloney
Copy link
Member

The plots look amazing great work @lukasgraf-internship and @nicHoch

@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2021

Codecov Report

Merging #21 (2c3428d) into master (cdb8609) will decrease coverage by 13.11%.
The diff coverage is 3.78%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #21       +/-   ##
===========================================
- Coverage   67.41%   54.29%   -13.12%     
===========================================
  Files           9        9               
  Lines         672      838      +166     
===========================================
+ Hits          453      455        +2     
- Misses        219      383      +164     
Impacted Files Coverage Δ
stixpy/science.py 39.35% <3.78%> (-18.15%) ⬇️
stixpy/vis/map_reprojection.py 57.89% <0.00%> (-7.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cdb8609...2c3428d. Read the comment docs.

@samaloney
Copy link
Member

samaloney commented Jul 2, 2021

This is fantastic thanks for the great work! Some small things that could maybe be improved there a a lot of magic numbers in the code but I guess this can't really be avoided with the plots maybe just some more comments to say why or how they were obtained. Also I notice in the doc built here (https://stixpy--21.org.readthedocs.build/en/21/code_ref/science.html) PlotPixelData class isn't showing up?

.gitignore Outdated
Comment on lines 157 to 158
/Minergie Test Data/
/Matplotlib Practice/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be better to keep this outside of .gitignore

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already removed

stixpy/science.py Show resolved Hide resolved
quadrant_font = {'weight': 'regular', 'size': 15}

if cmap is None:
clrmap = copy.copy(cm.get_cmap('viridis'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the copy.copy really needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise we get "will deprecate" warning if we set the out of range color

Comment on lines +534 to +535
xnorm = plt.Normalize(SubCollimatorConfig["SC Xcen"].min()*1.5, SubCollimatorConfig["SC Xcen"].max()*1.5)
ynorm = plt.Normalize(SubCollimatorConfig["SC Ycen"].min()*1.4, SubCollimatorConfig["SC Ycen"].max()*1.4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do the 1.5 and 1.4 come from

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we scale the position X with 1.5 to avoid to much margins.
the 1.4 for y is because we need a bit more margin in between for the detector name:

image

def det_config_plot(detector_config, axes, font, detector_id):
""" Shows a plot with the configurations of the detectors; the config plot. """
# Create Functions to convert 'Front' and 'Rear Orient'.
def mm2deg(x):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these make sense - can you just convert mm to degrees like this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a work around as the twin axis approach does not work in this subplot (axes) approach.
so we show the degree and the mm on the same axis and therefor have to deal with the scaling on our own

detector_config['Front Pitch'],
detector_config['Rear Pitch'],
0,
deg2mm(detector_config['Front Orient']),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The orientations are already in degree why try and convert, trying to get a component of the orientation or something?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so above

@paolomassa paolomassa mentioned this pull request Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants