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

[bump minor] Add new FVoigt script #1037

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

[bump minor] Add new FVoigt script #1037

wants to merge 12 commits into from

Conversation

andreicuceu
Copy link
Contributor

A simplified version of the FVoigt computation, based on the code by @moonlovist. Work in progress.



def voigt_profile(x, sigma=1, gamma=1):
return np.real(wofz((x + 1j*gamma) / (sigma * np.sqrt(2))))
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason to define the voigt profile function here instead of just using scipi.special.voigt_profile in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just did a quick test, and the two functions don't produce the same results. In fact our version appears to be off by exactly a factor of sqrt(pi) from the scipy version. @moonlovist are you sure we got the correct function here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the difference might be in using the Voigt function V in case of scipy and H in case of this computation, defined like this on wikipedia
image.
Anyway, using wofz or voigt_profile straight from scipy is fine (with the correct normalizations), just improves readability as you don't need to redefine things here, scipy is using wofz internally anyway (but in a c-based routine).

Copy link
Collaborator

Choose a reason for hiding this comment

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

If both are the same (once properly normalized), I would suggest changing this to using scipi.special.voigt_profile given that this is what we use in the DLA masking module, but this would not be a show stopper for the merge

Copy link
Contributor

Choose a reason for hiding this comment

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

they are as the scipy.special.voigt_profile is just a cythonized wrapper around woffz anyway, I'd mildly prefer using existing functions (with some comment about the difference in intrinsic normalization) over having our own version for smaller things like this, even more given we're using the scipy function elsewhere anyway...

@Waelthus
Copy link
Contributor

also: please add docstrings and ideally a test...

Copy link
Contributor

@julienguy julienguy left a comment

Choose a reason for hiding this comment

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

Hi, I suggest we add more information about the input files and output file in the script help string.
What are the definitions of the columns, what are their units.

@iprafols
Copy link
Collaborator

iprafols commented Sep 4, 2023

is this ready for review?

@andreicuceu
Copy link
Contributor Author

Yes, this has been tested and working for a while now.

Copy link
Collaborator

@iprafols iprafols left a comment

Choose a reason for hiding this comment

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

On top of the comments I added, I would run pylint and yapft to follow the same coding standards as the rest of the new parts of picca

bin/picca_compute_fvoigt_hcd.py Outdated Show resolved Hide resolved


def voigt_profile(x, sigma=1, gamma=1):
return np.real(wofz((x + 1j*gamma) / (sigma * np.sqrt(2))))
Copy link
Collaborator

Choose a reason for hiding this comment

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

If both are the same (once properly normalized), I would suggest changing this to using scipi.special.voigt_profile given that this is what we use in the DLA masking module, but this would not be a show stopper for the merge

bin/picca_compute_fvoigt_hcd.py Outdated Show resolved Hide resolved
bin/picca_compute_fvoigt_hcd.py Outdated Show resolved Hide resolved
bin/picca_compute_fvoigt_hcd.py Outdated Show resolved Hide resolved
bin/picca_compute_fvoigt_hcd.py Show resolved Hide resolved
@Waelthus Waelthus changed the title Add new FVoigt script [bump minor] Add new FVoigt script Sep 15, 2023
@iprafols
Copy link
Collaborator

Hi all, I modified the file so that it now uses functions already defined in dla_mask, instead of defining new functions that do the same things. @andreicuceu can you check that I did not accidentally add a normalisation issue?

@iprafols
Copy link
Collaborator

iprafols commented Nov 7, 2023

I fixed the typo and added the lyman beta absorption, but tests are still missing

@iprafols
Copy link
Collaborator

iprafols commented Nov 7, 2023

tests are failing due to a weird coveralls error. Maybe their server is down. Otherwise, they might have updated something and the new version is not backwards compatible. We should try to rerun failing tests in a while to see if it was just their server being down or not

@Waelthus
Copy link
Contributor

somewhere things are going wrong, here:
grafik
expected:
grafik

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.

None yet

4 participants