Giter VIP home page Giter VIP logo

Comments (1)

rhiannonlynne avatar rhiannonlynne commented on August 14, 2024

Hi - my apologies for the delay in replying to your issue. I've answered this in the community post (https://community.lsst.org/t/scheduler-not-working-for-given-ra-dec-and-mjd-start/8015/6) but basically .. for a bit more insight, check this out:

class MySurvey(BaseSurvey):
   def generate_observations_rough(self, conditions):
       obs = empty_observation()
       obs['RA'] = np.radians(273.0)
       obs['dec'] = np.radians(-78.0)
       obs['exptime'] = 30.  # Seconds
       obs['nexp'] = 2
       obs['filter'] = 'r'
       # If it's been 12 hours or more, don't try to execute the observation anymore
       obs['flush_by_mjd'] = conditions.mjd + 1
       obs['note'] = 'mysurvey'  # Always good to set the note to which survey generated the observation
       # Make it a list of n
       result = [obs] * 7
       return result
# load up a model observatory.
nside=32  # Specify the HEALpix resolution we want to do everything in.
mjd_start = 60218
mo = ModelObservatory(nside=nside, mjd_start=mjd_start)
conditions = mo.return_conditions()

my_survey = MySurvey([])
print("what's the current time?", conditions.mjd)
print("Is the current survey feasible and has a reward? (i.e. it's not -Infinity)", my_survey.calc_reward_function(conditions))
print("Ok, try the observations")
obs = my_survey.generate_observations(conditions)
print("did the conditions change? (they should not have here yet)", conditions.mjd)
pd.DataFrame(np.hstack(obs))[['RA', 'dec', 'mjd', 'exptime', 'filter', 'alt', 'az', 'airmass', 'night', 'slewtime', 'sunAlt']]
# Now to build our scheduler object, and run it for a day

scheduler = CoreScheduler([my_survey], nside=nside)
# sim_runner will return the updated model observatory, the updated scheduler, and an array of
# completed observations
print('starting time', mo.mjd)
mo, scheduler, observations = sim_runner(mo, scheduler,survey_length=0.3,
                                                verbose=True)
print('ending time', mo.mjd)
# Show what observations were acquired
pd.DataFrame(np.hstack(observations))[['RA', 'dec', 'mjd', 'exptime', 'filter', 'alt', 'az', 'airmass', 'night', 'slewtime', 'sunAlt']]

So basically, it looks like the field set during the run of sim_runner, but you couldn't see the observations which had been acquired because the way sim_runner exited did not return those observations.
You can see what time that sim_runner ended, even with an error, by checking on mo.mjd.

And because of this particular setup of MySurvey, this particular field is the only proposed observation even if it's not possible to observe because it's set already. MySurvey should check to see if the field is visible before proposing it with a valid reward value. This isn't really explored in this very basic introductory notebook .. and it doesn't really look like any of the other notebooks in this introductory set explore that problem very well either. However the "SlewtimeBasisFunction" does include an altitude limit by default and you can use that to mask off the targets when they're not visible.

from rubin_sim_notebooks.

Related Issues (4)

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.