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

feat(time): Solar/lunar ephemerides #271

Merged
merged 1 commit into from
Jul 28, 2024
Merged

Conversation

ketiltrout
Copy link
Member

@ketiltrout ketiltrout commented Jul 25, 2024

This adds six methods to caput.time.Observer to calculate (solar/lunar) (transits/risings/settings).

These functions are originally from ch_util.ephemeris where they originally worked only on the chime Observer. They've since been enhanced to use any Observer, so there's no reason now not to have them in the Observer object directly.

CHANGE FROM CH_UTIL VERSION

There is one major change to these functions from what was in ch_util.ephemeris: instead of a diameter of 0.6 degrees = 36 arcminutes, these methods now use a diameter of 100 arcminutes.

This means these functions now compute astronomical sun/moon rise/set, which is conventionally taken to occur when the centre of the sun/moon is 50 arcminutes below the horizon.

The 50 arcminute number comes from a solar/lunar radius of 16 arcminutes plus 34 arcminutes of atmospheric refraction at the horizon.

This change fixes the 3-minute discrepancy Mateus noticed when these functions were first ported from PyEphem (which does account for atmospheric refraction) to skyfield (which does not account for the refraction), here: https://github.com/chime-experiment/ch_util_private/commit/b505cf099c1de4eb39f2e34828e8da545d3db8e0

Transit times are unchanged: the atmospheric refraction at zenith is zero.

@ketiltrout ketiltrout requested a review from ljgray July 25, 2024 20:31
This adds six methods to `caput.time.Observer` to calculate
(solar/lunar) (transits/risings/settings).

These functions are originally from `ch_util.ephemeris` where
they originally worked only on the `chime` `Observer`.  They've
since been enhanced to use any `Observer`, so there's no reason
now not to have them in the `Observer` object directly, now.

CHANGE FROM CH_UTIL VERSION

There is one major change to these functions from what was in
`ch_util.ephemeris`:  instead of a `diameter` of 0.6 degrees
= 36 arcminutes, these methods now use a `diameter` of 100 arcminutes.

This means these functions now compute astronomical sun/moon rise/set,
which is conventionally taken to occur when the centre of the sun/moon
is 50 arcminutes below the horizon.

The 50 arcminute number comes from a solar/lunar radius of 16 arcminutes
plus 34 arcminutes of atmospheric refraction at the horizon.

This change fixes the 3-minute discrepancy Mateus noticed when these
functions were first ported from PyEphem (which _does_ account for
atmospheric refraction) to skyfield (which does _not_ account for the
refraction), here: chime-experiment/ch_util_private@b505cf0
Copy link
Contributor

@ljgray ljgray left a comment

Choose a reason for hiding this comment

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

I think this looks fine

ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Jul 25, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Jul 25, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Jul 25, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument rotation:

`ch_ephem` has also taken on the rotation data that was in `tools`
(where it's been re-imported from `ch_ephem`).  Not sure this is ideal.
Please comment on the `ch_ephem` PR if you can provide an opinion on
this.

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these is the unused `ch_util.tools._LAT_LON` which
had position data for various instruments which differed from the
position data provided by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
@ketiltrout ketiltrout requested a review from rikvl July 25, 2024 23:09
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Jul 26, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Jul 26, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Jul 27, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Jul 27, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Jul 27, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
@ketiltrout ketiltrout merged commit ce80fee into master Jul 28, 2024
5 checks passed
@ketiltrout ketiltrout deleted the solar-lunar_ephemerides branch July 28, 2024 17:27
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Jul 31, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Jul 31, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Jul 31, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Aug 1, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Aug 1, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Aug 1, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Aug 1, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
ketiltrout added a commit to chime-experiment/ch_ephem that referenced this pull request Aug 1, 2024
Extracts a lot of `ch_util.ephemeris` into a separate package.

General changes:

* Solar and lunar ephemeris functions have been converted into
  `caput.time.Observer` methods: radiocosmology/caput#271
* Other functions that take a `Observer` object, now use `None`
  as a default, and load the `chime` observer during execution if
  necessary.

More comments on specific submodules follow.

Catalogs:

This contains all the `ch_util/catalogs` plus a function
(`ch_ephem.catalogs.load`) to read them and return the parsed JSON.

The standard source catalogues loaded by the `sources` submodule need
to move to `ch_ephem`.  The other catalogues could stay in `ch_util`,
but it seems simpler to me to keep them all in the same place and
provide a uniform interface to them.

Coord:

Co-ordinate transforms etc.  These are essentially unchanged from
their versions in `ch_util.ephemeris`.

Observers:

Re-creates all the `caput.time.Observers` which used to be created
by `ch_util.ephemeris`, but for the most part, they have to be
fetched via name from the `get()` function.  The exception to this
is the `chime` Observer, which can be directly imported, since it's
the one usually needed.

Position data for the observers is now in a YAML data file
`instruments.yaml` which is parsed at import time.  New instrument
`Observer` objects can be added to `ch_ephem` just by adding information
for it to the YAML file.

Also note that `Observers` returned by this submodule have an extra
attribute, `rotation`, inserted into their `__dict__`, which is not
in `caput`.  This rotation is needed by `ch_ephem.coord.peak_ra`.
If we don't want to do this to these `Observers`, one other options
would be to keep `peak_ra` in `ch_util` (moving it to, say,
`ch_util.tools`), and then there's no need for rotation information
in this module.

Like `sources`, this submodule reads data from disk at import time,
so is not automatically imported into the base `ch_ephem` object.

Pointing:

Just Galt telescope pointing routines, unchanged from
`ch_util.ephemeris`.  These are another candidate we could consider
putting somewhere else in ch_util, if we don't want them here.

Sources:

Loads the standard source catalogs, and provides the calibrator objects
`CasA`, `CygA`, `TauA`, `VirA`.  Like `observers`, this submodule
reads data from disk at import time, so is not automatically imported
into the base `ch_ephem` object.

Time:

Time utilities, largely unchanged from what was in `ch_util.ephemeris`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Aug 1, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Aug 1, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Aug 1, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
ketiltrout added a commit to chime-experiment/ch_util that referenced this pull request Aug 1, 2024
This re-imports stuff moved to `ch_ephem`.  It both
re-imports everything that was moved back into `ch_util.ephemeris` for
backwards compatibility, but also removes references to
`ch_util.epheremis` from the code, using the newly-exported versions
of things directly.

This PR requires both:

* radiocosmology/caput#271
* chime-experiment/ch_ephem#1

Catalogs:

All the catalogs have been moved to `ch_ephem`, which provides a
standard interface to them via `ch_ephem.catalogs.load`.  To make this
change, `fluxcat.FluxCatalog.load` has been broken into two pieces.  The
new `fluxcat.FluxCatalog.load_dict` imports a catalog from an
already-parsed JSON dict (which is what `ch_ephem` provides).  The
original `fluxcat.FluxCatalog.load` works as it used to, but tail-calls
`load_dict` to do most of the importing.

Position data:

Position data (lat, lon, alt) is now obtained by fetching the parameter
out of the `caput.time.Observer` objects provided by `ch_ephem`.  The
constants in `ch_util.ephemeris` are populated by doing this.

Instrument geormetry:

`ch_ephem` has also taken on the geometry data (rotation, roll, offset)
that was in `tools` (where it's been re-imported from `ch_ephem`).

Private objects deleted:

I've also deleted a number of private objects which are no longer
being used (i.e. objects whose names start with a leading underscore).

Notable among these are the geometry constants from `ch_util.tools`
and the unused`ch_util.tools._LAT_LON` which had position data for
various instruments which differed from the position data provided
by `ch_util.ephemeris`.

Also removed are the long-deprectated `ch_util.ephemeris._get_chime` and
`ch_util.ephemeris.transit_RA`.
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.

2 participants