-
Notifications
You must be signed in to change notification settings - Fork 24
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
Incorrect normalization when restarting spectral cycles #134
Comments
Ok, so this is nothing to do with macro-atoms or any of my recent changes. I ran a very very simple supernova model as far back as Python 77 with no wind or disk on, 1d, star only. Run 10 spectral cycles, restart running 50 spectral cycles with the same model. Outputs should be identical except the longer run should have better S/N. This is the result (green is restarted). Clearly we are failing to normalise properly in this case. Name of issue changed. |
In case it's not clear- this probably means that for all runs which restarted the spectral cycles to get better S/N, the spectrum will have incorrect total flux. This is not a problem in my CV runs where I deliberately did not restart. |
Uh oh! |
It is! The problem is just that when we read in a spec_save file we don't normalise the stuff we read in. So for example, I am finding that if I run one model with 1 spectral cycles, then restart then run so that it does 5 cycles in total (4 more), the total flux is out by a factor of 1.8.. i.e we add 1 cycle of stuff to another 4 cycles, but the 4 cycles have a weight normalisation of (1/5) less than the spectrum we've read in. The saved spectrum we read in should be multiplied by a factor f: f = (cycles in old pf file) / (cycles in new pf file) That was explained terribly but you get the idea. simple change which I'll make when I get a minute. |
I've fixed this with a simple little function called spectrum_restart_renormalise() in commit agnwinds/python@3ec1dae Also verified that it produces correct results when all of the extra cycles are completed, and also if the restarted run is interrupted before the end (i.e. it is normalised correctly each cycle). Closing. |
This is a problem of my own making, and I'm just flagging it here for documentation purposes, as it is present in e.g. Python 78b. A short time back (see agnwinds/python@ec8ccec) I changed get_matom_f() - the function which computes the macro-atom emissivities - so as to only recompute if geo,pcycles was 0. The reason being that one shouldn't have to go through the very lengthy process of computing macro-atom emissivities if you just want to restart a run to get better photon stats.
At the moment a restarted model with 500 spectral cycles has a very different continuum level (green is the restarted run, identical model and wind state):
I must have made a mistake somewhere, which is probably very simple and related to normalising the photon weights or similar. I will correct ASAP.
The text was updated successfully, but these errors were encountered: