diff --git a/.gitignore b/.gitignore index 0bf6c0ed..8e502732 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ stx_scenario_* /*.fits .vscode + diff --git a/stix/idl/io/stx_check_fits_compatibility.pro b/stix/idl/io/stx_check_fits_compatibility.pro index 1b5c0cfe..51e5852e 100644 --- a/stix/idl/io/stx_check_fits_compatibility.pro +++ b/stix/idl/io/stx_check_fits_compatibility.pro @@ -30,7 +30,7 @@ ;- function stx_check_fits_compatibility, fits_path - fits_data = mrdfits( fits_path, 0, primary_header, silent = silent, /unsigned ) + fits_data = mrdfits( fits_path, 0, primary_header, /silent, /unsigned ) processing_level = sxpar(primary_header,'level') diff --git a/stix/idl/io/stx_read_fits.pro b/stix/idl/io/stx_read_fits.pro index 37961c7e..2aab8bae 100644 --- a/stix/idl/io/stx_read_fits.pro +++ b/stix/idl/io/stx_read_fits.pro @@ -23,7 +23,7 @@ ; ; :keywords: ; -; silent : in, type="int", default="0" +; silent : in, type="int", default="1" ; If set prevents informational messages being displayed. Passed through to mrdfits. ; ; :returns: @@ -45,10 +45,10 @@ ;- function stx_read_fits, fits_path, extension, header, silent = silent, mversion_full = mversion_full - default, silent, 0 + default, silent, 1 if ~keyword_set(mversion_full) then begin - ver = mrdfits(/version) + ;; ver = mrdfits(/version, /silent) ; commented out (FSc, 2023-09-26) since not used anywhere mversion_full = stx_get_mrd_version() mversion = mversion_full.split('\.') if ~(fix(mversion[0]) ge 2 and fix(mversion[1]) ge 27) and ~silent then begin diff --git a/stix/idl/processing/aux_data/stx_create_auxiliary_data.pro b/stix/idl/processing/aux_data/stx_create_auxiliary_data.pro index 8948f2b5..5eb28a19 100644 --- a/stix/idl/processing/aux_data/stx_create_auxiliary_data.pro +++ b/stix/idl/processing/aux_data/stx_create_auxiliary_data.pro @@ -83,6 +83,8 @@ if ~nb_within then begin (time_middle-time_data[t_before]) * aux_data_str[t_after].Z_SRF) / $ (time_data[t_after]-time_data[t_before]) sigma_X = 0. & sigma_Y = 0. + ; convert to single precision + X_SAS = float(X_SAS) & Y_SAS = float(Y_SAS) ; Apparent solar radius (arcsec) RSUN = ((time_data[t_after]-time_middle) * aux_data_str[t_before].spice_disc_size + $ @@ -167,6 +169,7 @@ if ~X_SAS.isnan() and ~Y_SAS.isnan() then begin print, X_SAS, Y_SAS, format='(" --- found (Y_SRF, -Z_SRF) = ", F7.1,",",F7.1)' print, sigma_X, sigma_Y, format='(" std. dev. = ", F7.1,",",F7.1)' endif + ; Correct SAS solution for systematic error measured in 2021 X_SAS += offset_X & Y_SAS += offset_Y sas_pointing = [X_SAS, Y_SAS] diff --git a/stix/idl/processing/imaging/fit_map_2dgauss.pro b/stix/idl/processing/imaging/fit_map_2dgauss.pro index cd25cdea..625d74bb 100644 --- a/stix/idl/processing/imaging/fit_map_2dgauss.pro +++ b/stix/idl/processing/imaging/fit_map_2dgauss.pro @@ -3,10 +3,12 @@ ; fit_map_2dgauss ; ; PURPOSE: -; Fits a 2D-Gaussian on a previously computed map +; Fits a 2D-Gaussian on a previously computed map. The centroid positions obtained from Gaussian fitting +; is printed on screen, both in helioprojective Cartesian coordinates and in heliographic (Stonyhurst) +; longitude and latitude. ; ; CALLING SEQUENCE: -; fit_map_2dgauss, in_map [, /do_plot] +; fit_map_2dgauss, in_map, hlon=hlon, hlat=hlat [, /do_plot] ; ; INPUTS: ; in_map : a map structure, as returned by imaging functions @@ -15,15 +17,16 @@ ; do_plot : if set, overplots contours at 25%, 50% and 75% of the Gaussian peak on the map ; (note that the map has to be already plotted in the active window) ; -; OUTPUTS: -; None. The centroid positions obtained from Gaussian fitting is printed on screen, in both -; helioprojective cartesian coordinates and heliographic (Stonyhurst) longitude and latitude +; OPTIONAL OUTPUTS: +; hlon, hlat : Heliographic Stonyhurst coordinates of source center +; gauss_X, gauss_Y : Helioprojective Cartesian coordinates of source center ; ; MODIFICATION HISTORY: ; 2022-01-07: F. Schuller (AIP, Germany): created +; 2023-02-21, FSc (AIP): added hlon, hlat as optional outputs ; ;- -pro fit_map_2dgauss, in_map, do_plot=do_plot +pro fit_map_2dgauss, in_map, do_plot=do_plot, hlon=hlon, hlat=hlat, gauss_X=gauss_X, gauss_Y=gauss_Y ; Dimensions of the map array if not is_struct(in_map) then begin print,"ERROR: input variable is not a structure." @@ -42,7 +45,8 @@ pro fit_map_2dgauss, in_map, do_plot=do_plot roll_xy, gauss_X/60.,gauss_Y/60., -1.*in_map.roll_angle, p1_x, p1_y coord = arcmin2hel(p1_x,p1_y, date=in_map.time, rsun=in_map.rsun, b0=in_map.b0, l0=in_map.l0) print,coord[1],coord[0],format='(" --> Heliographic LON = ",F7.2," ; LAT = ",F6.2)' - + hlon = coord[1] & hlat = coord[0] + ; Overplot contours at 25%, 50% and 75% of peak if keyword_set(do_plot) then begin ; arrays of X and Y coordinates diff --git a/stix/idl/processing/imaging/stx_imaging_pipeline.pro b/stix/idl/processing/imaging/stx_imaging_pipeline.pro index 6118dde4..83133b0a 100644 --- a/stix/idl/processing/imaging/stx_imaging_pipeline.pro +++ b/stix/idl/processing/imaging/stx_imaging_pipeline.pro @@ -18,34 +18,63 @@ ; imsize : size (in pixels) of the image to be generated (default: [128, 128]) ; pixel : size (in arcsec) of one pixel in the map (default: [2.,2.]) ; x_ptg, y_ptg : if provided, use these values instead of those found in the auxiliary file to correct for pointing +; force_sas : if set, uses SAS solution even if it's far off SolO's pointing +; no_sas : if set, don't use SAS solution but rely on SolO's pointing +; subc_labels : list of sub-collimators to be used in imaging algorithm ; ; OPTIONAL KEYWORDS: ; force_sas : if set, use SAS pointing solution even if very different from s/c pointing ; no_sas : if set, bypass SAS solution and use spacecraft pointing (corrected for systematics) instead ; no_small : if set, don't use small pixels data to generate the map -; +; method : select imaging algorithm; should be one of: "MEM" [default], "EM", or "clean" +; w_clean : for clean method, choose between uniform weighting (w_clean=1, default) and natural weighting (w_clean=0) +; clean_beam_width : for clean method, size of the beam to convolve the clean components with +; set_clean_boxes : should the user define the clean boxes interactively? (default: NO) +; ; OUTPUTS: ; Returns a map object that can be displayed with plot_map +; +; OPTIONAL OUTPUT: +; path_sci_file : contains the full path to the L1 SCI data file used as input ; ; EXAMPLES: -; mem_ge_map = stx_imaging_pipeline('2109230031', ['23-Sep-2021 15:20:30', '23-Sep-2021 15:22:30'], [18,28], [650.,-650.]) -; map_1 = stx_imaging_pipeline('2110090002', ['2021-10-09T06:29:50','2021-10-09T06:32:30'], [18,28], [20., 420.]) -; map_2 = stx_imaging_pipeline('2110090002', ['2021-10-09T06:29:50','2021-10-09T06:32:30'], [4,8], [20., 420.]) +; mem_ge_map = stx_imaging_pipeline('2109230031', ['23-Sep-2021 15:20:30', '23-Sep-2021 15:22:30'], [18,28]) +; map_1 = stx_imaging_pipeline('2110090002', ['2021-10-09T06:29:50','2021-10-09T06:32:30'], [18,28]) +; map_2 = stx_imaging_pipeline('2110090002', ['2021-10-09T06:29:50','2021-10-09T06:32:30'], [4,8]) +;; Example with user-provided pointing correction: +; map1 = stx_imaging_pipeline('2204020888', ['2022-04-02T13:18:10','2022-04-02T13:20:40'], [25,50], $ +; x_ptg=-1901.0, y_ptg=871.3) +;; User-defined map center and dimensions: +; map2 = stx_imaging_pipeline('2204020888', ['2022-04-02T13:22:30','2022-04-02T13:26:50'], [25,50], $ +; x_ptg=-1900.0, y_ptg=871.2, xy_flare=[-1900.,550.], imsize=[261,221], pixel=[2.5,2.5]) +;; Using only a sub-set of collimators: +; low_res = ['10a','10b','10c','9a','9b','9c','8a','8b','8c','7b','7c','6c'] +; map_th = stx_imaging_pipeline('2204020888', ['2022-04-02T13:37','2022-04-02T13:44'], [4,8], $ +; x_ptg=-1897., y_ptg=870.3, xy_flare=[-2000.,600.], imsize=[201,201], pixel=[3.,3.], subc_labels = low_res) ; ; MODIFICATION HISTORY: ; 2022-05-19: F. Schuller (AIP, Germany): created ; 2022-08-30, FSc: use stx_estimate_location to find source position if not given ; 2022-09-09, FSc: added optional argument bkg_uid ; 2022-10-06, FSc: adapted to recent changes in other procedures +; 2022-11-16, FSc: added optional argument subc_labels ; 2023-02-24, FSc: added optional keyword no_small +; 2023-09-06, FSc: added optional keyword method +; 2023-10-16, FSc: added optional keywords clean_beam_width and set_clean_boxes ; ;- -function stx_imaging_pipeline, stix_uid, time_range, energy_range, bkg_uid=bkg_uid, $ - xy_flare=xy_flare, imsize=imsize, pixel=pixel, x_ptg=x_ptg, y_ptg=y_ptg, $ - force_sas=force_sas, no_sas=no_sas, no_small=no_small +function stx_imaging_pipeline, stix_uid, time_range, energy_range, bkg_uid=bkg_uid, xy_flare=xy_flare, $ + imsize=imsize, pixel=pixel, x_ptg=x_ptg, y_ptg=y_ptg, force_sas=force_sas, no_sas=no_sas, $ + subc_labels=subc_labels, no_small=no_small, method=method, $ + w_clean=w_clean, clean_beam_width=clean_beam_width, set_clean_boxes=set_clean_boxes, $ + path_sci_file=path_sci_file + if n_params() lt 3 then begin print, "STX_IMAGING_PIPELINE" - print, "Syntax: result = stx_imaging_pipeline(stix_uid, time_range, energy_range [, xy_flare=xy_flare, imsize=imsize, pixel=pixel, x_ptg=x_ptg, y_ptg=y_ptg])" + print, "Syntax: result = stx_imaging_pipeline(stix_uid, time_range, energy_range [, bkg_uid=bkg_uid, xy_flare=xy_flare, $" + print, " imsize=imsize, pixel=pixel, x_ptg=x_ptg, y_ptg=y_ptg, force_sas=force_sas, no_sas=no_sas, $" + print, " subc_labels=subc_labels, no_small=no_small, method=method, w_clean=w_clean, $ + print, " clean_beam_width=clean_beam_width, set_clean_boxes=set_clean_boxes, path_sci_file=path_sci_file])" return, 0 endif @@ -54,8 +83,24 @@ function stx_imaging_pipeline, stix_uid, time_range, energy_range, bkg_uid=bkg_u ; l1a_data_folder = '/store/data/STIX/L1A_FITS/L1/' l1a_data_folder = '/store/data/STIX/L1_FITS_SCI/' + + ; sub-collimator labels + default, subc_labels, ['10a','10b','10c','9a','9b','9c','8a','8b','8c','7a','7b','7c','6a','6b','6c','5a','5b','5c','4a','4b','4c','3a','3b','3c'] + subc_index = stx_label2ind(subc_labels) + default, imsize, [128, 128] default, pixel, [2.,2.] + + ; Imaging algorithm to be used: make sure that the method is implemented + default, method, "MEM" + method = strupcase(method) + known_methods = ["MEM", "EM", "CLEAN"] + tst = where(known_methods eq method, i_tst) + if ~i_tst then begin + print, method, format='("Method ",A," not known. Please use one of the following:")' + print, known_methods + return, 0 + endif ;;;; @@ -93,7 +138,8 @@ function stx_imaging_pipeline, stix_uid, time_range, energy_range, bkg_uid=bkg_u ; If not given, try to estimate the location of the source from the data !p.background=0 if not keyword_set(xy_flare) then begin - stx_estimate_flare_location, path_sci_file, time_range, aux_data, flare_loc=xy_flare, energy_range=energy_range + stx_estimate_flare_location, path_sci_file, time_range, aux_data, $ + flare_loc=xy_flare, energy_range=energy_range, subc_index=subc_index print, xy_flare, format='(" *** INFO: Estimated flare location = (",F7.1,", ",F7.1,") arcsec")' print, xy_flare / aux_data.rsun, format='(" ... in units of solar radius = (",F6.3,", ",F6.3,")")' @@ -104,14 +150,40 @@ function stx_imaging_pipeline, stix_uid, time_range, energy_range, bkg_uid=bkg_u mapcenter = stx_hpc2stx_coord(xy_flare, aux_data) flare_loc = mapcenter - ; Compute calibrated visibilities - if keyword_set(no_small) then $ - vis = stx_construct_calibrated_visibility(path_sci_file, time_range, energy_range, mapcenter, $ - path_bkg_file=path_bkg_file, xy_flare=flare_loc, /no_small, sumcase='TOP+BOT') $ - else vis = stx_construct_calibrated_visibility(path_sci_file, time_range, energy_range, mapcenter, $ - path_bkg_file=path_bkg_file, xy_flare=flare_loc) + ; Next, we call the functions that take the data as input and generate the emission map. The functions + ; to be called depend on the imaging algorithm. + + if method eq "EM" then begin + pixel_data_summed = stx_construct_pixel_data_summed(path_sci_file, time_range, energy_range, $ + path_bkg_file=path_bkg_file, xy_flare=xy_flare) + + out_map = stx_em(pixel_data_summed, aux_data, imsize=imsize, pixel=pixel,mapcenter=mapcenter) + + endif else begin + ; Compute calibrated visibilities + if keyword_set(no_small) then $ + vis = stx_construct_calibrated_visibility(path_sci_file, time_range, energy_range, mapcenter, subc_index=subc_index, $ + path_bkg_file=path_bkg_file, xy_flare=flare_loc, /no_small, sumcase='TOP+BOT') $ + else vis = stx_construct_calibrated_visibility(path_sci_file, time_range, energy_range, mapcenter, subc_index=subc_index, $ + path_bkg_file=path_bkg_file, xy_flare=flare_loc) + + case method of + "MEM": out_map = stx_mem_ge(vis,imsize,pixel,aux_data,total_flux=max(abs(vis.obsvis)), /silent) + "CLEAN": begin + default, w_clean, 1 ; 1 = uniform weighting, 0 = natural weighting + niter = 100 ; Number of iterations + gain = 0.1 ; Gain used in each clean iteration + nmap = 10 ; Plot clean components and cleaned map every 10 iterations + if not keyword_set(clean_beam_width) then clean_beam_width = 14. ; clean components are convolved with this beam + if not keyword_set(set_clean_boxes) then set_clean_boxes = 0 + clean_map=stx_vis_clean(vis, aux_data, niter=niter, image_dim=imsize[0], PIXEL=pixel[0], $ + uniform_weighting = w_clean, gain=gain, nmap=nmap, $ + /plot, set_clean_boxes = set_clean_boxes, beam_width=clean_beam_width) + + out_map = clean_map[0] ; contains the CLEAN map + end + endcase + endelse - ; Finally, generate the map using MEM_GE - out_map = stx_mem_ge(vis,imsize,pixel,aux_data,total_flux=max(abs(vis.obsvis)), /silent) return, out_map end diff --git a/stix/idl/processing/imaging/stx_vis_clean.pro b/stix/idl/processing/imaging/stx_vis_clean.pro index 4e129319..2592a7cb 100644 --- a/stix/idl/processing/imaging/stx_vis_clean.pro +++ b/stix/idl/processing/imaging/stx_vis_clean.pro @@ -52,6 +52,7 @@ ; input visibility bag ; - spatial_frequency_weight - an array with the same number of elements as the input vis bag computed ; by the user's preference. +; - set_clean_boxes If set, let the user define a clean box or polygon ; - box_map map that is displayed for selecting the clean box ; ; @@ -363,7 +364,7 @@ function stx_vis_clean, vis, aux_data, niter = niter, image_dim = image_dim_in, if keyword_set(plot) then begin window,6,xsize=5*this_disp,ysize=2*this_disp - cleanplot + cleanplot, /silent !p.multi=[0,3,1] chs2=2. plot_map,out0,charsize=chs2 diff --git a/stix/idl/processing/pixel_data/stx_plot_selected_time_range.pro b/stix/idl/processing/pixel_data/stx_plot_selected_time_range.pro index aec2e93c..ec222b0f 100644 --- a/stix/idl/processing/pixel_data/stx_plot_selected_time_range.pro +++ b/stix/idl/processing/pixel_data/stx_plot_selected_time_range.pro @@ -52,6 +52,10 @@ pro stx_plot_selected_time_range, tim_axis, energy_ind, time_ind, counts, live_time_bins, subc_index, sumcase, energy_range, $ time_range, counts_bkg=counts_bkg, live_time_bkg=live_time_bkg + ; re-initialise UTBASE to handle UTC times properly when calling utplot + common utcommon + utbase = 0 + ;;********** Exclude first and last energy bin lightcurve = counts[1:30,*,*,*] @@ -169,7 +173,7 @@ wset,2 chsize=1.2 chsize_leg=1.8 clearplot -utplot,tim_axis,lightcurve, psym=10,ytitle='STIX count rate [s!U-1!N cm!U-2!N keV!U-1!N]', charsize=chsize,$ +utplot,tim_axis,lightcurve, psym=10, /xs, ytitle='STIX count rate [s!U-1!N cm!U-2!N keV!U-1!N]', charsize=chsize,$ title = this_date + ' ' + this_start_time + '-' + this_end_time + ' UT, ' + $ trim(energy_range[0],'(f12.1)') + '-' + trim(energy_range[1],'(f12.1)') + ' keV' outplot,tim_axis[time_ind],lightcurve[time_ind],psym=10,color=122 diff --git a/stix/idl/processing/spectrogram/stx_check_config_files.pro b/stix/idl/processing/spectrogram/stx_check_config_files.pro new file mode 100644 index 00000000..c4dd9bd9 --- /dev/null +++ b/stix/idl/processing/spectrogram/stx_check_config_files.pro @@ -0,0 +1,177 @@ +;+ +; :description: +; This procedure sets the relevant parameters for updating +; the energy lookup table (ELUT) files +; +; :categories: +; calibration, configuration +; +; :params: +; directory : in, required, type="string" +; path to the directory where the ELUT csv files are stored +; +; :keywords: +; verbose : in, optional, type="Boolean" +; if files are to be downloaded sock_copy is called with the verbose keyword +; +; :history: +; 31-Aug-2023 - ECMD (Graz), initial release +; +;- +pro stx_update_elut, directory, verbose = verbose + + url_root = 'http://dataarchive.stix.i4ds.net/STIX-CONF/elut/' + name_idx = 'elut_index.csv' + filter = 'elut_table*csv' + + stx_update_det_config_files, url_root = url_root, name_idx = name_idx, filter = filter, directory = directory + +end + +;+ +; :description: +; This procedure sets the relevant parameters for updating +; the science energy channel files +; +; :categories: +; calibration, configuration +; +; :params: +; directory : in, required, type="string" +; path to the directory where the Science Energy Channels csv files are stored +; +; :keywords: +; verbose : in, optional, type="Boolean" +; if files are to be downloaded sock_copy is called with the verbose keyword +; +; :history: +; 31-Aug-2023 - ECMD (Graz), initial release +; +;- +pro stx_update_echan, directory, verbose = verbose + + url_root = 'http://dataarchive.stix.i4ds.net/STIX-CONF/detector/' + name_idx = 'science_echan_index.csv' + filter = 'ScienceEnergyChannels*csv' + + stx_update_det_config_files, url_root = url_root, name_idx = name_idx, filter = filter, directory = directory, verbose = verbose + +end + +;+ +; :description: +; This procedure updates the detector configuration files +; +; :categories: +; calibration, configuration +; +; +; :keywords: +; url_root : in, required, type="string" +; the GitHub URL for the folder where the requested config files are available +; +; name_idx : in, required, type="string" +; the name of the index file for the requested configuration +; +; filter : in, required, type="string" +; specify the filenames of the configuration files in format compatible with find_file.pro +; +; directory : in, required, type="string" +; path to the directory where the configuration files are stored +; +; verbose : in, optional, type="Boolean" +; if files are to be downloaded sock_copy is called with the verbose keyword +; +; :examples: +; stx_update_det_config_files, url_root = 'https://github.com/i4Ds/STIX-CONF/raw/main/elut/', name_idx = 'elut_index.csv', $ +; filter = 'elut_table*csv', directory = getenv('STX_DET') +; +; :history: +; 31-Aug-2023 - ECMD (Graz), initial release +; +;- +pro stx_update_det_config_files, url_root = url_root, name_idx = name_idx, filter = filter, directory = directory, verbose = verbose + + url_idx = url_root + name_idx + + sock_copy, url_idx, out_dir = directory, local_file = local_file, /clobber, verbose = verbose + + str_index = read_csv(local_file, n_table_header = 1) + elut_filenames = (str_index.field4) + + files_present = find_file(concat_dir(directory, filter), count = count) + filenames_present = file_break(files_present, /name) + + for i = 0, n_elements(elut_filenames)-1 do begin + check = where(elut_filenames[i] eq filenames_present, count_found) + if count_found eq 0 then begin + url = url_root + elut_filenames[i] + sock_copy, url, out_dir = directory, verbose = verbose + endif + + endfor + + + +end + + +;+ +; :description: +; This procedure checks the latest version of the STIX-CONF folder in the data archive +; and determines if the elut and echan files need to be updated. +; +; :categories: +; calibration, configuration +; +; :params: +; directory : in, required, type="string" +; path to directory where config files are stored, should usually be /ssw/so/stix/dbase/detector +; +; :keywords: +; verbose : in, optional, type="Boolean", default = 0 +; if files are to be downloaded sock_copy is called with the verbose keyword +; +; :examples: +; stx_check_config_files, getenv('STX_DET') +; +; :history: +; 31-Aug-2023 - ECMD (Graz), initial release +; +;- +pro stx_check_config_files, directory, verbose = verbose + default, directory, getenv('STX_DET') + default, verbose, 0 + + run_update = 0 + net = have_network() + if net eq 0 then begin + print, 'Network unavailable. Configuration files such as ELUTs may be outdated.' + endif else begin + version_file = concat_dir(directory, 'stix_conf_version.txt') + find_version_file = loc_file(version_file) + + ourl = obj_new('IDLnetURL') + callback_data = ptr_new({loc:''}) + ourl->setproperty, url_scheme='http' + ourl->setproperty, url_host='dataarchive.stix.i4ds.net' + ourl->setproperty, url_path='/STIX-CONF/VERSION.TXT' + + online_version = ourl->get(/string) + + if find_version_file ne '' then begin + readcol, find_version_file, current_version, format = 'a', /silent + if current_version eq online_version then print,'STIX Configuration files are already up to date ' + online_version else run_update = 1 + endif else run_update = 1 + + if run_update then begin + + stx_update_elut, directory, verbose = verbose + stx_update_echan, directory, verbose = verbose + + ;update version file + str2file, online_version, version_file + endif + endelse + +end \ No newline at end of file diff --git a/stix/idl/processing/spectrogram/stx_convert_pixel_data.pro b/stix/idl/processing/spectrogram/stx_convert_pixel_data.pro index 28820c0d..3863f375 100644 --- a/stix/idl/processing/spectrogram/stx_convert_pixel_data.pro +++ b/stix/idl/processing/spectrogram/stx_convert_pixel_data.pro @@ -201,7 +201,7 @@ pro stx_convert_pixel_data, fits_path_data = fits_path_data, fits_path_bk = fit spec_in = reform(spec_in,[dim_counts[0],n_detectors, n_times]) - counts_spec = spec_in[energy_bins,*, *]/ reform(reproduce(eff_ewidth, n_detectors*n_times),n_energies, n_detectors, n_times) + counts_spec = spec_in[energy_bins,*, *] * reform(reproduce(eff_ewidth, n_detectors*n_times),n_energies, n_detectors, n_times) counts_spec = reform(counts_spec,[n_energies, n_detectors, n_times]) @@ -212,7 +212,7 @@ pro stx_convert_pixel_data, fits_path_data = fits_path_data, fits_path_bk = fit counts_err = reform(counts_err,[dim_counts[0],n_detectors, n_times]) - counts_err = counts_err[energy_bins,*, *]/ reform(reproduce(eff_ewidth, n_detectors*n_times),n_energies, n_detectors, n_times) + counts_err = counts_err[energy_bins,*, *] * reform(reproduce(eff_ewidth, n_detectors*n_times),n_energies, n_detectors, n_times) counts_err = reform(counts_err,[n_energies, n_detectors, n_times]) diff --git a/stix/idl/processing/spectrogram/stx_convert_science_data2ospex.pro b/stix/idl/processing/spectrogram/stx_convert_science_data2ospex.pro index c2a84ebb..da7c8e47 100644 --- a/stix/idl/processing/spectrogram/stx_convert_science_data2ospex.pro +++ b/stix/idl/processing/spectrogram/stx_convert_science_data2ospex.pro @@ -150,7 +150,7 @@ pro stx_convert_science_data2ospex, spectrogram = spectrogram, specpar = specpar energy_bins = spectrogram.energy_axis.low_fsw_idx - corrected_counts_bk = corrected_counts_bk[energy_bins,*]/reproduce(eff_ewidth, n_times) + corrected_counts_bk = corrected_counts_bk[energy_bins,*] * reproduce(eff_ewidth, n_times) corrected_counts_bk = reform(corrected_counts_bk,[n_elements(energy_bins), n_times]) @@ -161,7 +161,7 @@ pro stx_convert_science_data2ospex, spectrogram = spectrogram, specpar = specpar spec_in_bk = reform(spec_in_bk,dim_counts_bk[0], n_times) - spec_in_bk = spec_in_bk[energy_bins,*]/reproduce(eff_ewidth, n_times) + spec_in_bk = spec_in_bk[energy_bins,*] * reproduce(eff_ewidth, n_times) spec_in_bk = reform(spec_in_bk,[n_elements(energy_bins), n_times]) @@ -172,7 +172,7 @@ pro stx_convert_science_data2ospex, spectrogram = spectrogram, specpar = specpar error_bk = reform(error_bk, dim_counts_bk[0], n_times) - error_bk = error_bk[energy_bins,*]/reproduce(eff_ewidth, n_times) + error_bk = error_bk[energy_bins,*] * reproduce(eff_ewidth, n_times) error_bk = reform(error_bk,[n_elements(energy_bins), n_times]) diff --git a/stix/idl/processing/spectrogram/stx_convert_spectrogram.pro b/stix/idl/processing/spectrogram/stx_convert_spectrogram.pro index db1d723b..f6f04a50 100644 --- a/stix/idl/processing/spectrogram/stx_convert_spectrogram.pro +++ b/stix/idl/processing/spectrogram/stx_convert_spectrogram.pro @@ -151,11 +151,11 @@ pro stx_convert_spectrogram, fits_path_data = fits_path_data, fits_path_bk = fi spec_in = counts_in - counts_spec = spec_in[energy_bins, *]/ reproduce(eff_ewidth, n_times) + counts_spec = spec_in[energy_bins, *] * reproduce(eff_ewidth, n_times) counts_spec = reform(counts_spec,[n_energies, n_times]) - counts_err = data_str.counts_err[energy_bins,*]/ reproduce(eff_ewidth, n_times) + counts_err = data_str.counts_err[energy_bins,*] * reproduce(eff_ewidth, n_times) counts_err = reform(counts_err,[n_energies, n_times])