Skip to content

Allow more than 2 colormaps again #493

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

Merged
merged 5 commits into from
Jun 3, 2016
Merged

Allow more than 2 colormaps again #493

merged 5 commits into from
Jun 3, 2016

Conversation

Kully
Copy link
Contributor

@Kully Kully commented May 30, 2016

@choldgraf @theengineear

Guys,

So Chris, I think when you made the efficiency improvements to trisurf, you got rid of the capability of mapping divergent or colormaps of more than 2 colors. I have put that feature back now while trying to maintain the efficiency as best I could.

I put the 'rgb(%s, %s, %s)' stuff in the FigureFactory function _label_rgb(), which I was using anyways to convert a tuple to an rgb tuple.

Also, facecolor is not done in one line anymore, but is an empty list that keeps appending.

Let me know if you have any improvements to add.

(Also rewrote some doc strings for clarity)

@choldgraf
Copy link
Contributor

hey - you might be right, I'll take a look through the changes now and add
thoughts

On Mon, May 30, 2016 at 11:30 AM, Adam Kulidjian notifications@github.com
wrote:

@choldgraf https://github.com/choldgraf @theengineear
https://github.com/theengineear

Guys,

So Chris, I think when you made the efficiency improvements to trisurf,
you got rid of the capability of mapping divergent or colormaps of more
than 2 colors. I have put that feature back now while trying to maintain
the efficiency as best I could.

I put the 'rgb(%s, %s, %s)' stuff in the FigureFactory function
_label_rgb(), which I was using anyways to convert a tuple to an rgb tuple.

Also, facecolor is not done in one line anymore, but is an empty list that
keeps appending.

Let me know if you have any improvements to add.

(Also rewrote some doc strings for clarity)

You can view, comment on, or merge this pull request online at:

#493
Commit Summary

  • Allow more than 2 colormaps again

File Changes

Patch Links:


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#493, or mute the thread
https://github.com/notifications/unsubscribe/ABwSHZw0SxBrl3GPFWOhKllpCvlt8Xjeks5qGyzbgaJpZM4Ip-KO
.

@@ -1468,9 +1468,9 @@ def _find_intermediate_color(lowcolor, highcolor, intermed):
diff_1 = float(highcolor[1] - lowcolor[1])
diff_2 = float(highcolor[2] - lowcolor[2])

inter_colors = np.array([lowcolor[0] + intermed * diff_0,
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the benefit gained by making it a list and looping through? IME using arrays instead of lists almost always makes things much faster.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the benefit gained by making it a list and looping through? IME using arrays instead of lists almost always makes things much faster.

I don't necessarily think it's faster or anything like that. I actually just switched it back to this because I wanted it to work with my FF converting code

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if there's a benefit other than speed. E.g., if you thought the user might pass in tuples of variable shapes then it's probably better for the input to be a list or tuple or something (since arrays require consistency across dimensions). If you like, maybe I can take a pass through and make it work w/ arrays similar to the last PR. I don't think the syntax would be any different, and it'll likely be an order of magnitude faster to use arrays.

for i, j, k in t_colors.T]
return labelled_colors
# find the normalized distance t of a triangle face between vmin and
#vmax where the distance is normalized between 0 and 1
Copy link
Contributor

Choose a reason for hiding this comment

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

🎎 missing a in this comment.

@theengineear
Copy link
Contributor

Sorry to drag this one out longer on you with this review @Kully, ping me directly when you want another review and I can hop on it quickly.

@Kully
Copy link
Contributor Author

Kully commented Jun 2, 2016

@theengineear @choldgraf


return color
return face_color
Copy link
Contributor

Choose a reason for hiding this comment

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

💥 so much more readable! thanks!

@theengineear
Copy link
Contributor

@Kully I'm happy with it now :) 💃 from me.

@choldgraf unless there is something jarringly wrong about this still, can we merge it? That way, you could open up a new PR to improve computation speed again (with these new test constraints).

@choldgraf
Copy link
Contributor

I say go for it!

Sent from my phone, apologies for the curtness and type-os
On Jun 2, 2016 2:31 PM, "Andrew" notifications@github.com wrote:

@Kully https://github.com/Kully I'm happy with it now :) 💃 from me.

@choldgraf https://github.com/choldgraf unless there is something
jarringly wrong about this still, can we merge it? That way, you could open
up a new PR to improve computation speed again (with these new test
constraints).


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#493 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABwSHa5DVYzWqqXjgkAop1Gjw_sl1t3Wks5qHz28gaJpZM4Ip-KO
.

@Kully
Copy link
Contributor Author

Kully commented Jun 2, 2016

@Kully I'm happy with it now :) 💃 from me.

I don't think we can do that. Or maybe I'm not reading this right but...
int(t / (1./(len(colormap) - 1))) isn't the same as int(1 / (1./(len(colormap) - 1)))

I think the t does make the difference.

@Kully
Copy link
Contributor Author

Kully commented Jun 3, 2016

@theengineear

face_color = colormap[low_color_index]
if face == vmax:
# pick last color in colormap
face_color = colormap[-1]
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉 🔔 🎆

@theengineear
Copy link
Contributor

💃 💃 👯 !

@Kully Kully merged commit 9e721a3 into master Jun 3, 2016
@Kully Kully deleted the trisurf_plus_2_colormap branch June 3, 2016 15:59
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.

3 participants