3333 _default_psi ,
3434 _default_STAR ,
3535)
36- from .fast_starspot import precompile_functions
3736from .gaussian import (
3837 _precompile_gauss ,
3938 compute_rv ,
@@ -247,7 +246,7 @@ class Simulation:
247246 The planet to be simulated. Defaults to a template planet if not provided.
248247 pixel (SOAP.CCF or SOAP.Spectrum):
249248 The CCF or spectrum for each pixel in the quiet star. Defaults to solar CCF.
250- pixel_spot (SOAP.CCF or SOAP.Spectrum):
249+ pixel_ar (SOAP.CCF or SOAP.Spectrum):
251250 The CCF or spectrum for the spot(s). Defaults to solar spot CCF.
252251 active_regions (list of SOAP.ActiveRegion):
253252 List of active regions to include in the simulation.
@@ -264,7 +263,7 @@ class Simulation:
264263 resample_spectra (int):
265264 Resample the quiet star and spot spectra by this amount. No effect if using a CCF.
266265 interp_strategy (str):
267- Strategy for interpolating pixel and pixel_spot to a common wavelength array.
266+ Strategy for interpolating pixel and pixel_ar to a common wavelength array.
268267 verbose (bool):
269268 If True, prints additional information during simulation.
270269
@@ -273,8 +272,8 @@ class Simulation:
273272 Compute RV, FWHM, and BIS for a sequence of CCFs.
274273 set(**kwargs):
275274 Set multiple attributes of the simulation at once.
276- set_pixel(pixel, pixel_spot =None, pixel_plage=None):
277- Set the pixel, pixel_spot , and optionally pixel_plage for the simulation.
275+ set_pixel(pixel, pixel_ar =None, pixel_plage=None):
276+ Set the pixel, pixel_ar , and optionally pixel_plage for the simulation.
278277 plot(psi=None, **kwargs):
279278 Plot the simulation results.
280279 visualize(output, plot_type, lim=None, ref_wave=0, plot_lims=None, show_data=True):
@@ -305,7 +304,7 @@ def __init__(
305304 star = None ,
306305 planet = None ,
307306 pixel = "CCF" ,
308- pixel_spot = "CCF" ,
307+ pixel_ar = "CCF" ,
309308 active_regions = None ,
310309 ring = None ,
311310 nrho = 20 ,
@@ -326,33 +325,33 @@ def __init__(
326325 else :
327326 self .pixel = deepcopy (pixel )
328327
329- if pixel_spot == "CCF" :
330- self .pixel_spot = deepcopy (_default_CCF_active_region )
331- elif pixel_spot == None :
332- self .pixel_spot = None
328+ if pixel_ar == "CCF" :
329+ self .pixel_ar = deepcopy (_default_CCF_active_region )
330+ elif pixel_ar == None :
331+ self .pixel_ar = None
333332 else :
334- self .pixel_spot = deepcopy (pixel_spot )
333+ self .pixel_ar = deepcopy (pixel_ar )
335334
336335 _possible = (classes .CCF , classes .Spectrum )
337336 if not issubclass (self .pixel .__class__ , _possible ):
338337 raise ValueError ("`pixel` can only be a CCF or a Spectrum" )
339- if pixel_spot :
340- if not issubclass (self .pixel_spot .__class__ , _possible ):
341- raise ValueError ("`pixel_spot ` can only be a CCF or a Spectrum" )
338+ if pixel_ar :
339+ if not issubclass (self .pixel_ar .__class__ , _possible ):
340+ raise ValueError ("`pixel_ar ` can only be a CCF or a Spectrum" )
342341
343342 # Test if the spectrum size of the active region and spot are the same. If not it can follow two strategies:
344343 # - spot2quiet: Interpolate the spot spectrum to match the quiet spectrum size
345344 # - quet2spot : Interpolate the quiet spectrum to match the spot spectrum size
346345 if not self ._ccf_mode :
347- if self .pixel .n != self .pixel_spot .n :
346+ if self .pixel .n != self .pixel_ar .n :
348347 if interp_strategy == "spot2quiet" :
349- self .pixel_spot .interpolate_to (self .pixel .wave , inplace = True )
348+ self .pixel_ar .interpolate_to (self .pixel .wave , inplace = True )
350349 elif interp_strategy == "quiet2spot" :
351- self .pixel .interpolate_to (self .pixel_spot .wave , inplace = True )
350+ self .pixel .interpolate_to (self .pixel_ar .wave , inplace = True )
352351 if verbose :
353352 print (f"convolving spot spectra to R={ inst_reso } " )
354- self .pixel_spot .convolve_to (inst_reso , inplace = True )
355- self .pixel_spot .resample (resample_spectra , inplace = True )
353+ self .pixel_ar .convolve_to (inst_reso , inplace = True )
354+ self .pixel_ar .resample (resample_spectra , inplace = True )
356355
357356 # convolve the quiet and spot spectra to the instrument resolution
358357 if verbose :
@@ -395,7 +394,7 @@ def __init__(
395394
396395 # connect pixels with the star
397396 self .star ._pixel = self .pixel
398- self .star ._pixel_spot = self .pixel_spot
397+ self .star ._pixel_ar = self .pixel_ar
399398
400399 # convert star's vrot to the same units as the pixel
401400 self .star .set_vrot_units (self .pixel ._rv_units )
@@ -475,30 +474,30 @@ def set(self, **kwargs):
475474 except AttributeError :
476475 print (f'attribute "{ k } " does not exist' )
477476
478- def set_pixel (self , pixel , pixel_spot = None , pixel_plage = None ):
477+ def set_pixel (self , pixel , pixel_ar = None , pixel_plage = None ):
479478 """Set this simulation's pixel
480479
481480 Args:
482481 pixel (SOAP.CCF or SOAP.Spectrum):
483482 The CCF or spectrum for each pixel in the quiet star
484- pixel_spot (SOAP.CCF or SOAP.Spectrum):
483+ pixel_ar (SOAP.CCF or SOAP.Spectrum):
485484 The CCF for the spots
486485 pixel_plage (SOAP.CCF or SOAP.Spectrum):
487486 The CCF for the plages
488487 """
489488 pixel .vrot = self .star .vrot
490489 self .pixel = pixel
491490
492- if pixel_spot is not None :
493- self .pixel_spot = copy (pixel_spot )
491+ if pixel_ar is not None :
492+ self .pixel_ar = copy (pixel_ar )
494493 if pixel_plage is not None :
495494 raise NotImplementedError ("spots and plages use the same pixel" )
496495
497496 # force recalculation of itot
498497 self .itot_cached = False
499498 # connect CCFs with the star
500499 self .star ._pixel = self .pixel
501- self .star ._pixel_spot = self .pixel_spot
500+ self .star ._pixel_ar = self .pixel_ar
502501
503502 def plot (self , psi = None , ** kwargs ):
504503 fig , axs , ani = plots .plot_simulation (self , psi = psi , ** kwargs )
@@ -556,13 +555,13 @@ def run_itot(self, skip_rv=False, cache=True):
556555 pixel = without_units (self .pixel )
557556 if skip_rv :
558557 pixel_quiet = np .zeros (pixel .n_v )
559- flux_quiet = stspnumba .itot_flux (star .u1 , star .u2 , self .grid )
558+ flux_quiet = stspnumba .itot_flux (star .coeffs , star .law , self .grid )
560559 else :
561560 pixel_quiet , flux_quiet = stspnumba .itot_rv (
562561 star .vrot ,
563562 star .incl ,
564- star .u1 ,
565- star .u2 ,
563+ star .coeffs ,
564+ star .law ,
566565 self .star .diffrotB ,
567566 self .star .diffrotC ,
568567 self .star .cb1 ,
@@ -574,15 +573,14 @@ def run_itot(self, skip_rv=False, cache=True):
574573 )
575574
576575 else :
577- precompile_functions ()
578576 pixel = self .pixel .to_numba ()
579577 # pixel = without_units(self.pixel)
580- flux_quiet = stspnumba .itot_flux (star .u1 , star .u2 , self .grid )
578+ flux_quiet = stspnumba .itot_flux (star .coeffs , star .law , self .grid )
581579 pixel_quiet = stspnumba .itot_spectrum_par (
582580 star .vrot ,
583581 star .incl ,
584- star .u1 ,
585- star .u2 ,
582+ star .coeffs ,
583+ star .law ,
586584 self .star .diffrotB ,
587585 self .star .diffrotC ,
588586 self .star .cb1 ,
@@ -675,31 +673,31 @@ def calculate_signal(
675673 if DEBUG :
676674 None
677675 # print("Active region pixel")
678- # plt.plot(self.pixel_spot .wave, self.pixel_spot .flux )
676+ # plt.plot(self.pixel_ar .wave, self.pixel_ar .flux )
679677 # plt.xlabel("Wavelength")
680678 # plt.ylabel("Flux")
681679 # plt.show()
682680 if self ._ccf_mode :
683681 pixel = without_units (self .pixel )
684- if self .pixel_spot :
685- pixel_spot = without_units (self .pixel_spot )
682+ if self .pixel_ar :
683+ pixel_ar = without_units (self .pixel_ar )
686684 else :
687685 pixel = self .pixel .to_numba ()
688- if self .pixel_spot :
689- pixel_spot = self .pixel_spot .to_numba ()
686+ if self .pixel_ar :
687+ pixel_ar = self .pixel_ar .to_numba ()
690688 if DEBUG :
691689 import matplotlib .pyplot as plt
692690
693691 plt .plot (pixel .rv , pixel .intensity )
694- plt .plot (pixel_spot .rv , pixel_spot .intensity )
692+ plt .plot (pixel_ar .rv , pixel_ar .intensity )
695693 plt .show ()
696694 if len (active_regions ) != 0 :
697695 out = stspnumba .active_region_contributions (
698696 psi ,
699697 star ,
700698 active_regions ,
701699 pixel ,
702- pixel_spot ,
700+ pixel_ar ,
703701 self .grid ,
704702 self .nrho ,
705703 self .wlll ,
@@ -713,31 +711,31 @@ def calculate_signal(
713711 try :
714712 plt .plot (flux_spot )
715713 plt .show ()
716- plt .plot (pixel_spot_flux .T )
714+ plt .plot (pixel_ar_flux .T )
717715 plt .show ()
718716 except :
719717 None
720718
721- pixel_spot_bconv = out [1 ]
722- pixel_spot_flux = out [2 ]
719+ pixel_ar_bconv = out [1 ]
720+ pixel_ar_flux = out [2 ]
723721
724- pixel_spot_tot = out [3 ]
722+ pixel_ar_tot = out [3 ]
725723 # total flux of the star affected by active regions
726724 FLUXstar = FLUXstar - flux_spot
727725 # plt.plot(FLUXstar)
728726 # plt.show()
729727 # CCF of the star affected by the flux effect of active regions
730- pixel_flux = pixel_flux - pixel_spot_flux
728+ pixel_flux = pixel_flux - pixel_ar_flux
731729 # CCF of the star affected by the convective blueshift effect of
732730 # active regions
733- pixel_bconv = pixel_bconv - pixel_spot_bconv
731+ pixel_bconv = pixel_bconv - pixel_ar_bconv
734732 # CCF of the star affected by the total effect of active regions
735- pixel_tot = pixel_tot - pixel_spot_tot
733+ pixel_tot = pixel_tot - pixel_ar_tot
736734 if DEBUG :
737735 if skip_rv == False :
738736 plt .close ()
739737 print ("Effect of the spot in the spectra" )
740- plt .plot (pixel_spot_tot .T / np .max (pixel_spot_tot , axis = 1 ))
738+ plt .plot (pixel_ar_tot .T / np .max (pixel_ar_tot , axis = 1 ))
741739 plt .plot (pixel_tot .T / np .max (pixel_tot , axis = 1 ), "--" )
742740 plt .show ()
743741 else :
@@ -762,8 +760,8 @@ def calculate_signal(
762760 star .incl ,
763761 date ,
764762 date .size ,
765- star .u1 ,
766- star .u2 ,
763+ star .coeffs ,
764+ star .law ,
767765 self .grid ,
768766 pixel .wave ,
769767 self .pixel .to_numba (),
@@ -803,8 +801,8 @@ def calculate_signal(
803801 star .incl ,
804802 date ,
805803 date .size ,
806- star .u1 ,
807- star .u2 ,
804+ star .coeffs ,
805+ star .law ,
808806 self .grid ,
809807 pixel .rv ,
810808 pixel .intensity ,
@@ -905,7 +903,7 @@ def calculate_signal(
905903 fwhm_flux , span_flux = 0.0 , 0.0
906904 rv_bconv = compute_rv_2d (_rv , pixel_bconv )
907905 fwhm_bconv , span_bconv = 0.0 , 0.0
908- rv_tot = compute_rv_2d (_rv , pixel_bconv )
906+ rv_tot = compute_rv_2d (_rv , pixel_tot )
909907 fwhm_tot , span_tot = 0.0 , 0.0
910908 elif skip_bis :
911909 rv_flux , fwhm_flux = compute_rv_fwhm_2d (_rv , pixel_flux ).T
@@ -954,7 +952,6 @@ def calculate_signal(
954952 )
955953
956954 if DEBUG :
957- print ("I am in line 965" )
958955 plt .plot (_rv , ccf_pixel_flux .T )
959956 plt .show ()
960957
0 commit comments