Code Monkey home page Code Monkey logo

spamm's People

Contributors

antking avatar astrodmm avatar demitri avatar gisederosa avatar jotaylor avatar justincely avatar pancoast avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

spamm's Issues

dill version incompatibility

With dill version 0.2.8.2, the function dill.dill was replaced with dill._dill. Even though there is a supposed fix for this it's not working for me when unpickling pickle files made with 0.2.7.1. The only solution is to downgrade dill to 0.2.7.1 to load older pickle files.

Shouldn't be an issue for pickle files made with 0.2.8.2.

This is mostly an issue for me during testing.

Emission Lines

Issue transferred from justincely/spamm:
Create emission lines components (broad and narrow)

Remove wiki

Now that we have legit docs, it's time to remove the wiki.

Unable to pickle Model instance with new specutils version

The refactored specutils version uses Tabular1D in wcs_wrapper:
https://github.com/astropy/specutils/blob/26d80182b10a62f064caa619363d520cdc944e66/specutils/wcs/wcs_wrapper.py#L58
But Tabular1D can't be pickled

> this = Tabular1D(np.arange(10), np.arange(10))                                                                                                             

> pickle.dump(this, open("tester.p", "wb"))                                                                                                                  
---------------------------------------------------------------------------
PicklingError                             Traceback (most recent call last)
<ipython-input-21-fd38e6f8bdb3> in <module>
----> 1 pickle.dump(this, open("tester.p", "wb"))

PicklingError: Can't pickle <class 'abc.Tabular1D'>
Name: Tabular1D
Inputs: ('x0',)
Outputs: ('y',): attribute lookup Tabular1D on abc failed

This problem propagates all the way through so that when a Model instance is returned by SPAMM, it cannot be pickled. This is a really big deal, since there's a ton of information stored in Model and the emcee.sampler instance. I tried saving Model as a json, but nothing worked.

MPI Branch

Issue transferred from justincely/spamm:
Test it or kill it

Rename flux_error?

It's a bit misleading because specutils.Spectrum1D uses uncertainty while spamm.Spectrum uses flux_error.

Clean up plotting modules

They're scattered everywhere right now. I think the answer is to more plot_spamm_results.py to spamm/ or Analysis.py or something. ???

BalmerContinuum & PseudoContinuum

Issue transferred from justincely/spamm:
Test/Improve Anthea's implementation of Balmer Continuum/pseudo continuum

Anthea: Edited psuedo-continuum algorithm so that electron density is included properly. There was a typo previously. Also have created a new function for estimating the intensities of 51<n<400 Balmer lines, which estimates the excitation temperature from the Storey & Hummer ratios. The fit is still not great to the fake data, this is partly because I don't know what electron density was used in making the fake data and whether we need to fit for this. My method of estimating the excitation temperature may also be inaccurate, but the reference paper Kovacevic et al 2014 (http://www.sciencedirect.com.ezp.lib.unimelb.edu.au/science/article/pii/S0273117713007382?np=y) was very unclear about this.

HostGalaxyComponent -- stellar dispersion

Issue transferred from justincely/spamm:
gisederosa:
Improve performance of stellar dispersion modeling

Roberto: I have implemented the stellar dispersion parameter in the host templates, according to our last discussion. It is extremely slow and it is not activated so as to not cause delays on the tests of other components. To activate it, you need to comment and uncomment the lines that calculate the Kmat matrix in the flux subroutine of the Host Galaxy component.

antking:
I have changed how stellar dispersion is implemented in the host galaxy component that runs significantly faster but it needs more testing. I cannot find where the true values are for the fake host component data are. Can someone point me in the right direction and I will perform the necessary tests?

Example run crashes with pickle

https://github.com/antking/SPAMM/blob/758bb3247bead8f288b269f113baec7a28c8f990/examples/simple_run_general.py#L156

With pickle or cPickle, pickle dump crashes with:
*** _pickle.PicklingError: Can't pickle <class 'weakref'>: attribute lookup weakref on builtins failed
The only workaround I've found is to use dill:
https://pypi.python.org/pypi/dill

However, this creates an additional package dependency for the user. We should investigate the root issue and try to fix it eventually.

NuclearContinuum

Issue transferred from justincely/spamm:
Implement broken power-law + comptonized disk

Fool-proof loading of templates

Since the normalizations are linked to the order of the templates, we need to ensure they are always loaded in the order the user intends to. A reasonable approach to this could be ordering the templates by starting wavelength.

However, while this will work for the iron component, it will not for host galaxy. Maybe a more straightforward alphabetization would be best.

make SPAMM class

like there are so many things being carried around... maybe it needs to all be encapsulated into a class?

Can we delete extra Balmer Continuum scripts?

I think we only use BalmerContinuumCombined.py? @antking can I delete BalmerContinuum.py, BalmerContinuum_AK_super.py, and BalmerPseudoContinuum.py?

I would then rename BalmerContinuumCombined.py to BalmerContinuum.py.

Fe Component

Issue transferred from justincely/spamm:
Push latest updates

Move repo to STScI

We need to move the repo to either myself or @gisederosa 's personal account, then that person will transfer it to STScI's account.

Improve output text to screen

It could be cleaned up a bit, including

  • having fewer iteration printouts
  • getting rid of some useless text

Currently it looks like:

Mean acceptance fraction: 0.332
Saved pickle file 20190522_1327/model_20190522_1327.pickle.gz
	Saved model_20190522_1327_triangle.png
Plotting the MCMC chains.
	Saved model_20190522_1327_chain.png
Plotting the model posterior PDFs.
	Saved model_20190522_1327_posterior.png
Saved 20190522_1327/model_20190522_1327_posterior.pdf
executed in 0:00:12.307435

Change the way component parameters are stored

Currently they are stored in a list, which requires params to be in a specific order and accessed through self.parameter.index. This is a very error prone method. Instead, we should think about changing the parameters to be stored in a dictionary.

Fix yaml loader

parse_pars.py needs to be updated, it is throwing the following warning:

parse_pars.py:22: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  pars = yaml.load(f)

Intermittent statistics error in Samples

Sometimes this error occurs when using statistics.mode. Re-running SPAMM once or twice gets rid of it.

Mean acceptance fraction: 0.358
Saved pickle file 20190523_5826/model_20190523_5826.pickle.gz
Traceback (most recent call last):
  File "test_spamm.py", line 138, in <module>
    test_spamm(components=comps, n_walkers=int(args.n_walkers), n_iterations=int(args.n_iterations))
  File "test_spamm.py", line 107, in test_spamm
    n_iterations=n_iterations)
  File "/user/jotaylor/git/spamm/spamm/run_spamm.py", line 156, in spamm
    make_plots_from_pickle(pname, outdir)
  File "/user/jotaylor/git/spamm/spamm/analysis.py", line 245, in make_plots_from_pickle
    S = Samples(pname, outdir=outdir, gif=gif, last=last, step=step)
  File "/user/jotaylor/git/spamm/spamm/Samples.py", line 31, in __init__
    self._get_stats()
  File "/user/jotaylor/git/spamm/spamm/Samples.py", line 55, in _get_stats
    self.modes.append(statistics.mode(chain))
  File "/Users/jotaylor/anaconda3/envs/spamm/lib/python3.7/statistics.py", line 506, in mode
    'no unique mode; found %d equally common values' % len(table)
statistics.StatisticsError: no unique mode; found 2 equally common values

I/O

Finalize YAML input work. I have created a preliminary yaml file but have no way to read in yet.

numpy convolve faster than fftw convolve

I did some line profiling today and found that the numpy convolve function is several factors faster than the currently implemented pyfftw covolution function. I have replaced the function in the local balmercontinuumcombined log_conv function but should be performed throughout (aka in host galaxy and Fe template and eventually in spectrum object or utils function)

replacement should be done as followed
flux_conv = fftwconvolve_1d(flux_rebin, kernel)
to
flux_conv = np.convolve(flux_rebin, kernel,mode='same')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.