Code Monkey home page Code Monkey logo

opsimsummary's Introduction

Build Status DOI

OpSimSummary is a codebase developed to interact with the LSST Operations Simulator outputs. Currently they are used for catalog Time Domain Simulations. This includes a library that can be called by simulation codes to obtain the set of LSST pointings observing a particular point, as well as a script which uses the library and precomputes such pointings and store them in an observation library. This storage is in a format specific to SNANA

Using OpSimSummary

OpSimSumamry is open source and licensed under BSD 3-clause. While a release is available at zenodo the software will continue to be developed as needed in this github repository. If you plan to use a released version on zenodo, you can cite the specific release (for example the current release using the doi (for example see the Export section of the zenodo page for the release.) Alternatively, you can cite the a specific non-release version on the github repository through the git SHA.

Additionally, in both cases, please cite the code paper. If you are using bibtex, NASA ADS provides a bibtex for this reference (as also other formatted forms).

  • Documentation is hosted at github_pages. The overview section has snippets for the use as an API as well as documentation of the script needed to create SNANA simlib files. (This is described in greater detail in the a demo notebook)

Installation and Software Requirements

opsimsummary runs on python 3.6+ . The list of required software to run opsimsummary is listed here. For installation methods, please see the documentation

opsimsummary's People

Contributors

catarina-alves avatar chrisfrohmaier avatar cnsetzer avatar farrukhazfar avatar rbiswas4 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opsimsummary's Issues

Adjust `HealpixelizedOpSim` to account for no dithers in DDF

While we have been using the ditheredRA and ditheredDec for creating HealpixelizedOpSim, we have seen that this leads to lowering of number of visits in the DDF areas. It is understood that finally, DDF visits will have a smaller dither, and we will approximate this by setting the dither to 0 for DDF fields and rebuilding HealpixelizedOpSim.

  • Recreate OpSimOutput so that any record with ddf propid is preferentially chosen as DDF.
  • Change ditheredRA, ditheredDecto fieldRA,fieldDec
  • Change code in HealpixelizedOpSim to use the new ditheredRA , ditheredDec

Add a wrapper to initialize the OpSim Summary from the database directly

Currently, the class is initialized with a pandas DataFrame object, and reading the opsim output into it is the user's responsibility. This is useful, in that the user can select different parts of the opsim through sql queries before writing to dataFrame. On the other hand, the user has to do these things.

The goal would be to allow the same flexibility but offer an easier one line method to read in standard
opsim outputs.

Make OpSimOut be able to deal with propID combinations that are not registered?

Currently, the subset attribute of OpSimOut acts more like a registry to a sequence of propIDs. However, even when we know the propID values we want to select, we cannot set subset to None in the argument. (We need to set it to the default combined) for it get the correct tables.

  • We need to fix this problem.

A way to do this is by actually creating a registry and populating it from the proposal table. But it is not clear if that is what we want to do.

Make test opsim database creation script better

#43 was fixed by a quick and dirty solution of adding a new script to add the proposal table to the test OpSim database. What we want to do is to

  • keep the methods in make_smallOpSim available as part of a utils library in opsimsummary or elsewhere
  • make methods of writing such scripts easier by adding query and write methods to OpSimOut or appending different records, and use those to write a single script.

Add pruning

Add mechanism for pruning pointings for a set of points.

Pruning is solved for HealpixTiles, but should be kept in the general case. Perhaps this is more an issue for varsim, rather than OpSimSummary

Easier instantiations of `HealpixelizedOpSim` and `MapTile2Pointing`

Currently, opsimsummary.HealpixelizedOpSim can only be instantiated from a dataFrame, which the user must provide. Create class methods

  • fromOpSimDB to create these from opsim sqlite databases,
  • fromOpSimHDF and convenient storage of the Summary table on hdf file with argument 'table'. This will allow MapTile2Pointing (#41) work more easily.

`HealpixTree` Does not work

htree = HealpixTree(nside=1, nest=True)
htree.pixelsAtResolutionLevel(0, 8, nside=None)

throws the errors:

global name 'hpt' is not defined

Keep Visualization separate since basemap seems harder to install.

Currently, OpSimSummary imports objects from the visualization.py module from the __init__, implying that not having a basemap will cause the install of opsimsummary to fail. The problem is that basemap seems somewhat hard to install (though it is usually easy to install via conda install -c anaconda basemap). For example, this seems to be the case on Cori, after installing the python modules and the stack for reasons I have not figured out. However, basemap is not required for everything, so it is better to separate this out, so that opsimsummary install can proceed without basemap with an appropriate warning, rather than an exception.

Add a table with provenance data to Healipxelized OpSim Outputs

Currently, a Healpixelized OpSim database writtent to disc does not contain any provenance information. Add this information in the form of a table Called metadata:

This table should contain the following information

version : string
OpSim DataBase : string
NSIDE : int
factor : int
inclusive : True/False
date : time at which this is written
machine: host information
indexed : True/False

Modify the install script

  • Check if the script is running in travis CI or not.
    This stack overflow answer explains how this can be done
  • If it is in travis, set location of the MINICONDA script to $HOME, else read a file off a hidden file to set the tarball location.
  • Create a conda environment rather than install directly.

Speed up `HealpixelizedOpSim`

Currently, the pointings observing each point source is calculated either by query disc to provide a maximal set of pointings overlapping the tile, and then pruned according to the position of the point. The pointings overlapping the tile are calculated through functions like Healpy.query_disc and the process is slow if the million observations of the entire OpSim is considered along with millions of Healpixels. The gain in using HealpixelizedOpSim is that there are numerous sources in each Healpixel, and don't require reading through the entire OpSim. This is often done with a preComputed HealpixelizedOpSim, but these are large files which need to be stored.

The proposal is to use BallTree methods to speed up the calculation of pointings for each SN.

Introduce support for gzip databases

The precomputed HealpixelizedOpSim stored for NSIDE=128 (NSIDE=256 is too large ~ 1GB) corresponding to the enigma_1189_micro.db database used for continuous integration is ~200MB. This can be brought down to ~50 MB using gzip compression as shown in scripts/make_healpixeldb.py. While ~200MB will probably work, it is still a lot of space, and it would be good to replace this with the ~50 MB file. This also means that tests will have to start from gzipped opsim databases.

  • include gzipped version and add script in .travis installs to unzip the database in situ
  • Improve support by using sqlalchemy + gzip libraries to make opsim_output.py be able to do this.

MWEBV value is hard coded to 0.

When I wrote this, I set the MWEBV values to 0.0 to get started. This is clearly wrong, and needs to be corrected by using a proper set of values.

Database output test should now use `HealPixelizedOpSim` class for output

  • We have a class opsimsummary.HealPixelizedOpSim which now provides an API for many of the tasks in scripts to write out healpixels to databases. We should now rewrite the scripts to uses this API
  • There should be a test of the writing to database API tested against the sparse matrix algebra.

Rededine the example_data directory within the `__init__` function so that the pkg directory path does not need to be obtained .

Currently, we access the example_data directory from the package path by looking at the package file as in the following way:

pkgDir = os.path.split(oss.__file__)[0]
dbname = os.path.join(pkgDir, 'example_data', 'enigma_1189_micro.db')

By defining the pkgDir variable in the __init__.py of the package, we should be able to find the pkgdir as

pkgDir = opsimsummary.pkgDir
data_dir = oss.example_data

Making it more convenient to access in examples and tests.

Provide an interface to abstract different methods in OpSimSummary to get ObsHistIDs for a tileID

Currently there are two ways envisaged for obtaining the ObsHistID values for a tile ID.

  1. using a computation from a dataframe representing the opsim output which is implemented in opsimsummary.HealpixelizedOpSim.obsHistIDForTile() and requires the opsim output as a dataframe as input.
  2. Precomputed results of 1. stored in a database.

The idea is that there should be a common way of reading both of these and providing obsHistID for a tileID for both of these methods. Create a class MapTile2Pointing in healpix.py to do this.

Rewrite Enigma_1189_micro.db

The micro database created for examples only had the summary table. Now, we have started using the proposal table. Thus in order for our examples to work, we need to write out the proposal table as well.

cadence_plot zoom in does not have right xlabels

fig1c = EnigmaDeepSummary.cadence_plot(fieldList[0], observedOnly=False, sql_query='night < 250 and night > 230', nightMax=250, nightMin=230, deltaT=1) as shown below. The xticklabels should have started from 230 instead of 0. 

cadence

The code that I think should do this is inserted, but commented out right now, because of an EOF error

`addVec` should use `vecColName`

While the HealpixelizedOpSim API allows one to name a vector column, addVec which is called by the init statement does not. This should be remedied.

`OpSimOut.fromOpSimDB` type methods should support a `sql_query`

Currently, we have a class method OpSimOut.fromOpSimDB which allos one to consturct and OpSimOut object from the database directly. It would be good if this could support a sql_query method to allow users to apply the sql query before the usual queries involved.

A use case is what is needed in Twinkles where we only care about a single fieldID. In this case it would be useful to be able to apply the sql query of SELECT * FROM Summary WHERE fieldID == 1427 in a pd.sql_query statement rather than a pd.read_sql_table statement.

Method to create hdf files

We have had examples of how the hdf serialization of OpSim summary tables would work.

  • It would be good to put this in a method of sumamrize_opsim.OpSimOutput so that it is easily accessible.
  • We must add the proposal table to the hdf files so that it can work with the read in methods. Thus enigma, minion, opsim outputs must be redone
  • While redoing, we must use the '_all' format that we introduced in the refactor, and then use selection in the hdf read method.

Healpix support

  • Get set of pointings for healpix tiles.
  • Write tests and example demo.

Include gzipped test database and unzipping in install script

Do part of #54

  • Include gzipped version of healpixelized database produced by script scripts/make_healpixeldb.py.
  • add script in .travis installs to unzip the database in situ
  • Update users how they can run on their machines.

This means users will have unzip this database themselves unless there is a install script as suggested in #37 . This probably means adding to install/readme instructions

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.