• Welcome to Religious Forums, a friendly forum to discuss all religions in a friendly surrounding.

    Your voice is missing! You will need to register to get access to the following site features:
    • Reply to discussions and create your own threads.
    • Our modern chat room. No add-ons or extensions required, just login and start chatting!
    • Access to private conversations with other members.

    We hope to see you as a part of our community soon!

Python debugging

Meow Mix

Chatte Féministe
Anybody good at Python, specifically matplotlib and/or astropy that wouldn't mind helping debugging some code? There's always StackOverflow (but some people are mean there) and I have colleagues that help but, hey, you never know with the RF community.
 

Heyo

Veteran Member
Anybody good at Python, specifically matplotlib and/or astropy that wouldn't mind helping debugging some code? There's always StackOverflow (but some people are mean there) and I have colleagues that help but, hey, you never know with the RF community.
Never programmed in Python but then again, I am (was) a programmer not an (X language) programmer. (And I have found errors in code written in languages I don't know multiple times.)
 

Polymath257

Think & Care
Staff member
Premium Member
I've done some python programming. Not anything specifically with matplotlib or astropy.
 

Meow Mix

Chatte Féministe
Well, this is the code I've adapted from some existing code for now (so this is part of the problem, I didn't write this from scratch, which I'm about to just give up and do).

[GALLERY=media, 9535]Pyth1 by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]
[GALLERY=media, 9536]Pyth2 by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]
[GALLERY=media, 9537]Pyth3 by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]
[GALLERY=media, 9538]Pyth4 by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]
[GALLERY=media, 9539]Pyth5 by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]
[GALLERY=media, 9540]Pyth6 by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]
[GALLERY=media, 9541]Pyth7 by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]

This is the plot it's supposed to produce:

[GALLERY=media, 9542]Pythplot by Meow Mix posted Jul 16, 2021 at 6:35 PM[/GALLERY]

And this is the error that I get:
Traceback (most recent call last):
File "C:/Users/ErinAF/PycharmProjects/ResearchScripts/Sersic_n_vs_Dv_Erin.py", line 124, in <module>
main()
File "C:/Users/ErinAF/PycharmProjects/ResearchScripts/Sersic_n_vs_Dv_Erin.py", line 117, in main
labels = plots(n_proper, er_x, medians, low_errors, high_errors)
File "C:/Users/ErinAF/PycharmProjects/ResearchScripts/Sersic_n_vs_Dv_Erin.py", line 76, in plots
plt.errorbar(er_x, medians, yerr=[low_errors, high_errors], fmt=None, ecolor='r', elinewidth=2, zorder=4)
File "C:\Users\ErinAF\anaconda3\lib\site-packages\matplotlib\pyplot.py", line 2604, in errorbar
return gca().errorbar(
File "C:\Users\ErinAF\anaconda3\lib\site-packages\matplotlib\__init__.py", line 1438, in inner
return func(ax, *map(sanitize_sequence, args), **kwargs)
File "C:\Users\ErinAF\anaconda3\lib\site-packages\matplotlib\axes\_axes.py", line 3262, in errorbar
plot_line = (fmt.lower() != 'none')
AttributeError: 'NoneType' object has no attribute 'lower'

Now, I've gone to StackExchange and looked up this "AttributeError: 'NoneType' object has no attribute 'lower'" and most of the responses are that something's wrong with the source file, such as if there's a blank row or column. But I've double checked my csv, all nearly 3,000 lines of galaxies. There are no blanks.

Edit: Also I've obviously commented out the lines to save the figure and have it set just to show it until this gets worked out.
 

dybmh

דניאל יוסף בן מאיר הירש
I don't know python, but I noticed in first image there appears to be a syntax error at "delimiter =". Is there supposed to be a space between "delimiter" and the "="? The other two parameters don't have the space there.
 

Polymath257

Think & Care
Staff member
Premium Member
I don't know python, but I noticed in first image there appears to be a syntax error at "delimiter =". Is there supposed to be a space between "delimiter" and the "="? The other two parameters don't have the space there.

There probably should not be an underscore there. A blank space would be OK, though.
 

Meow Mix

Chatte Féministe
I don't know python, but I noticed in first image there appears to be a syntax error at "delimiter =". Is there supposed to be a space between "delimiter" and the "="? The other two parameters don't have the space there.

The space is OK, I just goofed. I fixed it for consistency though because now that it's been pointed out, it would have bugged me :sweatsmile:
 

Meow Mix

Chatte Féministe
Literally nobody at StackOverflow caught this. Good resource, but many people there are snooty and mean.
 
Top