question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: `sgnlog()` and `sgnlogspace()`

See original GitHub issue

Hi all, I am the author of pymrt, a library for working with quantitative MRI.

I have been recently refactoring the code base and I am now trying to put the more general functionalities into separate libraries. Right now these functions are in flyingcircus.num: https://bitbucket.org/norok2/flyingcircus/src/master/flyingcircus/num.py

I think that a number of these functions – e.g. unsqueeze(), ndim_slice(), etc. – might be a good fit for either numpy or scipy. The code is, as of now, fairly well documented in the docstrings and doctested. However, I do understand that numpy/scipy have adopted a different style than me. Therefore, before undertaking the effort of preparing that code for numpy I would like to understand if there is any interest in merging those functions in numpy.

In an effort to keep all this as atomic as possible, I would eventually write separate issues for each of the unrelated functions, unless I receive comments against this practice in this thread.

The functions I would like to pull first are:

  1. sgnlog(x) which is just the log(x) * sign(x)
  2. sgnlogspace() for generating logarithmically spaced points

Compared to the existing log(x) and logspace(x), they have the advantage that the base of the logarithm can be specified as a parameter. Another important difference between logspace() and sgnlogspace(), is that in sgnlogspace() the start and stop arguments do not refer to the exponent but to the actual start and stop.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
rkerncommented, Jul 31, 2018

I’ve needed them in the past, but rarely, and I found it straightforward enough to compose them from the available primitives. We are actively trying not to expand numpy’s already-crowded namespace, I think that leans towards not including them.

Briefly scanning over num.py, I don’t see anything that leaps out to me given that rubric. However, I do think that scipy.special might be a good home for sgnlog() (base-e only), sgnlog2() and maybe sgnlog10() if implemented as ufuncs. Some of the other functions in num.py might have a good home in various parts of scipy.

0reactions
WarrenWeckessercommented, Oct 25, 2021

@norok2, thanks for proposing your enhancement to NumPy. After reviewing the above comments, and considering that no NumPy devs have expressed interest in adding these functions to NumPy in the last three years, I’m closing the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Feature Request] logrange sweep · Issue #1944 - GitHub
I would like to do a grid search over learning rates, which in my case would be best done in the log range....
Read more >
numpy.logspace — NumPy v1.24 Manual
Return numbers spaced evenly on a log scale. In linear space, the sequence starts at base ** start (base to the power of...
Read more >
numpy.logspace() in Python - GeeksforGeeks
The numpy.logspace() function returns number spaces evenly w.r.t interval on a log scale. Syntax : numpy.logspace(start, stop, num = 50, ...
Read more >
checkpoint not complete, cannot allocate new log - Ask TOM
Tom, I am receiving the following message in my alert log and can find no documentation explaining what this error means or how...
Read more >
ECE 3040 Lecture 3: Matlab Basics II
In Matlab the “=” sign is reserved for assigning a value (numeric or text) to a variable: Variables are cataloged in the Workspace...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found