@@ -222,24 +222,17 @@ def einstein_coeff(temp_estimate, transition_freq, mol_tag):
222
222
return au / u .s
223
223
224
224
225
- def photod_rate (time , time_scale , target , id_type , observatory , time_format ,
226
- mol_tag ):
225
+ def photod_rate (ephemobj , mol_tag ):
227
226
# imported here to avoid circular dependency with activity.gas
228
227
from ..activity .gas import photo_timescale
228
+ from ..data import Ephem
229
229
230
- epoch = Time (time , scale = time_scale , format = time_format )
231
- obj = Horizons (id = target , epochs = epoch .jd , location = observatory ,
232
- id_type = id_type )
230
+ if not isinstance (ephemobj , Ephem ):
231
+ raise ValueError ('ephemobj must be a `sbpy.data.ephem` instance.' )
233
232
234
- try :
235
- orb = obj .ephemerides ()
236
-
237
- except ValueError :
238
-
239
- raise
240
-
241
- delta = (orb ['delta' ].data * u .au ).to ('m' )
242
- r = (orb ['r' ].data )
233
+ orb = ephemobj
234
+ delta = (orb ['delta' ]).to ('m' )
235
+ r = (orb ['r' ])
243
236
cat = JPLSpec .get_species_table ()
244
237
mol = cat [cat ['TAG' ] == mol_tag ]
245
238
name = mol ['NAME' ].data [0 ]
@@ -258,8 +251,7 @@ def photod_rate(time, time_scale, target, id_type, observatory, time_format,
258
251
259
252
260
253
def total_number (integrated_line , temp_estimate , transition_freq , mol_tag ,
261
- aper , b , time , target , time_scale , id_type , observatory ,
262
- time_format ):
254
+ aper , b , ephemobj ):
263
255
"""
264
256
Basic equation relating number of molecules with observed integrated flux.
265
257
This is given by equation 10 in
@@ -285,8 +277,8 @@ def total_number(integrated_line, temp_estimate, transition_freq, mol_tag,
285
277
transition_freq ,
286
278
mol_tag ))).decompose ()
287
279
288
- photod = photod_rate (time , time_scale , target , id_type , observatory ,
289
- time_format , mol_tag )
280
+ photod = photod_rate (ephemobj , mol_tag )
281
+
290
282
beta = photod ["beta" ]
291
283
292
284
sigma = (1. / 2. * beta * b * con .c / (transition_freq * aper )).value
@@ -456,10 +448,8 @@ def fit(self, spec):
456
448
"""
457
449
458
450
def prodrate_np (self , spectra , temp_estimate , transition_freq ,
459
- mol_tag , time , target , vgas = 1 * u .km / u .s ,
460
- aper = 25 * u .m , observatory = '500' , b = 1.2 ,
461
- time_format = 'iso' , time_scale = 'utc' ,
462
- id_type = 'designation' ):
451
+ mol_tag , ephemobj , vgas = 1 * u .km / u .s ,
452
+ aper = 25 * u .m , b = 1.2 ):
463
453
"""
464
454
| Returns production rate based on Drahus 2012 model referenced. Includes
465
455
| no photodissociation
@@ -485,14 +475,8 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
485
475
temp_estimate : `~astropy.units.Quantity`
486
476
Estimated temperature in Kelvins
487
477
488
- time : str
489
- Time of observation of any format supported by `~astropy.time`
490
-
491
- target : str
492
- | Target designation, if there is more than one aparition you
493
- | will be prompted to pick a more specific identifier from a
494
- | displayed table and change the parameter id_type to 'id'.
495
- | Look at `~astroquery.jplhorizons` for more information.
478
+ ephemobj: `~sbpy.data.Ephem` object
479
+ An `~sbpy.data.Ephem` object that holds ephemerides information
496
480
497
481
mol_tag : int or str
498
482
Molecule identifier. Make sure it is an exclusive identifier.
@@ -503,27 +487,11 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
503
487
aper : `~astropy.units.Quantity`
504
488
Telescope aperture in meters. Default is 25 m
505
489
506
- observatory : str
507
- | Observatory identifier as per `~astroquery.jplhorizons`
508
- | Default is geocentric ('500')
509
-
510
490
b : int
511
491
| Dimensionless factor intrinsic to every antenna. Typical
512
492
| value, and the default for this model, is 1.22. See
513
493
| references for more information on this parameter.
514
494
515
- time_format : str
516
- | Time format, see `~astropy.time` for more information
517
- | Default is 'iso' which corresponds to 'YYYY-MM-DD HH:MM:SS'
518
-
519
- time_scale : str
520
- | Time scale, see `~astropy.time` for mor information.
521
- | Default is 'utc'
522
-
523
- id_type : str
524
- | ID type for target. See `~astroquery.jplhorizons` for more.
525
- | Default is 'designation'
526
-
527
495
Returns
528
496
-------
529
497
q : `~astropy.units.Quantity`
@@ -533,11 +501,15 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
533
501
--------
534
502
>>> import astropy.units as u # doctest: +SKIP
535
503
504
+ >>> from astropy.time import Time # doctest: +SKIP
505
+
506
+ >>> from sbpy.data import Ephem # doctest: +SKIP
507
+
536
508
>>> from sbpy.spectroscopy import prodrate_np # doctest: +SKIP
537
509
538
510
>>> temp_estimate = 33. * u.K # doctest: +SKIP
539
511
540
- >>> target = '900918 ' # doctest: +SKIP
512
+ >>> target = '103P ' # doctest: +SKIP
541
513
542
514
>>> vgas = 0.8 * u.km / u.s # doctest: +SKIP
543
515
@@ -551,11 +523,12 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
551
523
552
524
>>> spectra = 1.22 * u.K * u.km / u.s # doctest: +SKIP
553
525
554
- >>> time = '2010-11-3 00:48:06' # doctest: +SKIP
526
+ >>> time = Time('2010-11-3 00:48:06', format='iso') # doctest: +SKIP
527
+
528
+ >>> ephemobj = Ephem(target, epochs=time.jd, id_type='id') # doctest: +SKIP
555
529
556
530
>>> q = prodrate_np(spectra, temp_estimate, transition_freq, # doctest: +SKIP
557
- mol_tag, time, target, vgas, aper,
558
- b=b, id_type='id')
531
+ mol_tag, ephemobj, vgas, aper, b=b)
559
532
560
533
>>> q # doctest: +SKIP
561
534
<Quantity 1.0432591198553935e+25 1 / s>
@@ -577,17 +550,6 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
577
550
assert isinstance (vgas , u .Quantity )
578
551
assert isinstance (aper , u .Quantity )
579
552
assert isinstance (spectra , u .Quantity ) # K * km / s
580
- assert isinstance (time , str ), "Input time as string, i.e. '2018-05-14'"
581
- assert isinstance (time_scale , str ), "Input time scale as string, i.e.\
582
- 'utc' see astropy.time.Time for \
583
- more info"
584
- assert isinstance (target , str ), "Object name should be a string and\
585
- should be identifiable through \
586
- astroquery.jplhorizons"
587
- assert isinstance (observatory , str ), "Observatory should be a string\
588
- and identified through \
589
- astroquery.jplhorizons,\
590
- i.e. '500' (geocentric)"
591
553
592
554
if type (transition_freq ) == list :
593
555
@@ -631,8 +593,8 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
631
593
gu = sum (gu_list ) / float (len (gu_list ))
632
594
energy_J = sum (energy_J_list ) / float (len (energy_J_list ))
633
595
634
- photod = photod_rate (time , time_scale , target , id_type , observatory ,
635
- time_format , mol_tag )
596
+ photod = photod_rate (ephemobj , mol_tag )
597
+
636
598
delta = photod ["delta" ]
637
599
638
600
calc = ((16 * np .pi * k * t_freq .decompose () *
@@ -662,8 +624,8 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
662
624
663
625
au = einstein_coeff (temp_estimate , transition_freq , mol_tag )
664
626
665
- photod = photod_rate (time , time_scale , target , id_type , observatory ,
666
- time_format , mol_tag )
627
+ photod = photod_rate (ephemobj , mol_tag )
628
+
667
629
delta = photod ["delta" ]
668
630
669
631
calc = ((16 * np .pi * k * t_freq .decompose () *
@@ -678,10 +640,8 @@ def prodrate_np(self, spectra, temp_estimate, transition_freq,
678
640
return q
679
641
680
642
def production_rate (self , coma , integrated_line , temp_estimate ,
681
- transition_freq , mol_tag , time , target ,
682
- aper = 25 * u .m , observatory = '500' , b = 1.2 ,
683
- time_format = 'iso' , time_scale = 'utc' ,
684
- id_type = 'designation' ):
643
+ transition_freq , mol_tag , ephemobj ,
644
+ aper = 25 * u .m , b = 1.2 ):
685
645
"""
686
646
Calculate production rate for `GasComa`
687
647
@@ -702,39 +662,17 @@ def production_rate(self, coma, integrated_line, temp_estimate,
702
662
mol_tag : int or str
703
663
Molecule identifier. Make sure it is an exclusive identifier.
704
664
705
- time : str
706
- Time of observation of any format supported by `~astropy.time`
707
-
708
- target : str
709
- | Target designation, if there is more than one aparition you
710
- | will be prompted to pick a more specific identifier from a
711
- | displayed table and change the parameter id_type to 'id'.
712
- | Look at `~astroquery.jplhorizons` for more information.
665
+ ephemobj: `~sbpy.data.Ephem` object
666
+ An `~sbpy.data.Ephem` object that holds ephemerides information
713
667
714
668
aper : `~astropy.units.Quantity`
715
669
Telescope aperture in meters. Default is 25 m
716
670
717
- observatory : str
718
- | Observatory identifier as per `~astroquery.jplhorizons`
719
- | Default is geocentric ('500')
720
-
721
671
b : int
722
672
| Dimensionless factor intrinsic to every antenna. Typical
723
673
| value, and the default for this model, is 1.22. See
724
674
| references for more information on this parameter.
725
675
726
- time_format : str
727
- | Time format, see `~astropy.time` for more information
728
- | Default is 'iso' which corresponds to 'YYYY-MM-DD HH:MM:SS'
729
-
730
- time_scale : str
731
- | Time scale, see `~astropy.time` for mor information.
732
- | Default is 'utc'
733
-
734
- id_type : str
735
- | ID type for target. See `~astroquery.jplhorizons` for more.
736
- | Default is 'designation'
737
-
738
676
Returns
739
677
-------
740
678
Q : `~astropy.units.Quantity`
@@ -743,6 +681,9 @@ def production_rate(self, coma, integrated_line, temp_estimate,
743
681
Examples
744
682
--------
745
683
>>> from sbpy.activity.gas import Haser # doctest: +SKIP
684
+ >>> from sbpy.data import Ephem # doctest: +SKIP
685
+ >>> from astropy.time import Time # doctest: +SKIP
686
+
746
687
>>> coma = Haser(Q, v, parent) # doctest: +SKIP
747
688
>>> Q = spec.production_rate(coma, molecule='H2O') # doctest: +SKIP
748
689
@@ -755,15 +696,16 @@ def production_rate(self, coma, integrated_line, temp_estimate,
755
696
>>> b = 0.74 # doctest: +SKIP
756
697
>>> vgas = 0.5 * u.km / u.s # doctest: +SKIP
757
698
758
- >>> time = '2017-12-22 05:24:20' # doctest: +SKIP
699
+ >>> time = Time('2017-12-22 05:24:20', format = 'iso') # doctest: +SKIP
700
+ >>> ephemobj = Ephem(target, epochs=time.jd) # doctest: +SKIP
759
701
>>> spectra = 0.26 * u.K * u.km / u.s # doctest: +SKIP
760
702
761
703
>>> parent = photo_timescale('CO') * vgas # doctest: +SKIP
762
704
763
705
>>> coma = Haser(Q_estimate, vgas, parent) # doctest: +SKIP
764
706
765
707
>>> Q = spec.production_rate(coma, spectra, temp_estimate, # doctest: +SKIP
766
- transition_freq, mol_tag, time, target ,
708
+ transition_freq, mol_tag, ephemobj ,
767
709
aper=aper, b=b) # doctest: +SKIP
768
710
769
711
>>> print(Q) # doctest: +SKIP
@@ -785,8 +727,7 @@ def production_rate(self, coma, integrated_line, temp_estimate,
785
727
# integrated_line = self.integrated_flux(transition_freq) - not yet implemented
786
728
787
729
molecules = total_number (integrated_line , temp_estimate ,
788
- transition_freq , mol_tag , aper , b , time , target ,
789
- time_scale , id_type , observatory , time_format )
730
+ transition_freq , mol_tag , aper , b , ephemobj )
790
731
791
732
model_molecules = coma .total_number (aper )
792
733
0 commit comments