Commit 55275be62782412a9e0936229b7d3d13b2140e4b

Authored by Ilyes Choubani
1 parent 4da8e20e
Exists in master

allowing no_obj plotting of extiction data

src/idl/dustem_plugin_modify_dust_polx.pro
... ... @@ -52,7 +52,10 @@ IF keyword_set(paramtag) THEN BEGIN
52 52 ENDIF
53 53  
54 54 ;Retrieving this system variable (dustem output)
55   -IF isa(!dustem_current) then st=*!dustem_current else out=0 & goto, the_end
  55 +if ~isa(!dustem_current) then begin
  56 + out =0
  57 + goto, the_end
  58 +ENDIF else st=(*!dustem_current)
56 59  
57 60 ;below are the default values for the plugin parameters
58 61 smallp_fact=1. ;This is the default multiplicative factore to the dust polarization
... ...
src/idl/dustemwrap_plot_noobj.pro
... ... @@ -672,8 +672,7 @@ if test_m then begin
672 672  
673 673  
674 674 ENDIF
675   -
676   - cgcontrol, winid_m, execute=1
  675 +
677 676  
678 677 ENDIF
679 678  
... ... @@ -682,171 +681,159 @@ ENDIF
682 681 stop
683 682 if test_x then begin
684 683 ;Generating extinction window and saving window ID
  684 + if !run_pol then window,1,xsize=main_wxsize,ysize=main_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (EXTINCTION)' else window,1,xsize=main_wxsize,ysize=main_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (EXTINCTION)';, wback='grey';,wobject=winobj_m
685 685  
686   - if iswinext then begin
687   -
688   - if !run_pol then cgwindow,wxsize=main_wxsize,wysize=main_wysize,wtitle='DUSTEMWRAP '+!dustem_version.version+' (EXTINCTION)' else cgwindow,wxsize=main_wxsize,wysize=main_wysize,wtitle='DUSTEMWRAP '+!dustem_version.version+' (EXTINCTION)';, wback='grey';,wobject=winobj_m
689   - winid_x = cgquery(dimensions=dim_x,/current) ;this has to be changed because the dimensions of this array change with the data sets present (extinction/emission).
690   - !dustemcgwin_id.ext = winid_x
691   -
692   - cgcontrol, winid_x, execute=0
693   - ;cgset, winid_m
694   - ;Plotting model string (legend)
695   - xxpos = 0.015
696   - yypos = 0.97
697   - ;Plotting Hydrogen column density string (legend)
698   - cgtext, xxpos, yypos,'Model : '+!dustem_model,color=0,/normal,charsize = 1.2,/addcmd ;& cmdind_m+=1 This is the first command in the window
699   - yypos = 0.95
700   - cgtext, xxpos, yypos,textoidl('N_{H}')+textoidl(' (H/cm^2) : ')+strmid(string(*!dustem_HCD,format='(1E10.2)'),2),color=0,/normal,charsize = 1.2,/addcmd & cmdind_x+=1
701   -
702   - ;Plotting of the number of iterations completed by the fitter
703   -
704   - ;Plotting of the number of runs
705   - ;Getting the width of the unrefreshed string
706   - widthtot=0.
707   - ;cgtext, xxpos, yypos,'Runs : ',color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
708   - cgtext, xxpos, yypos,'Iteration : ',color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
709   - widthtext = thiswidth
710   - widthtot+= thiswidth ;fixed width
711   - !dustemcgwin_ncmds.runs.txtwdth = thiswidth
712   -
713   - ;Getting the width of the refreshed string
714   - cgtext, xxpos, yypos,strtrim(!dustem_iter.act,2),color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
715   - widthtot+= thiswidth;varying width
716   -
717   - ;These two lines will also have to be modified when plotting the refreshed values
718   - xxpos = 0.015 ;1.0 - widthtot - 0.03
719   - yypos = 0.015
720   -
721   - ;Displaying fixed part
722   - ;cgtext, xxpos, yypos,'Runs : ',color=0,/normal,charsize = 1.35,/addcmd & cmdind_x+=1
723   - cgtext, xxpos, yypos,'Iteration : ',color=0,/normal,charsize = 1.35,/addcmd & cmdind_x+=1
724   - ;Displaying refreshed part (first run . This is the command that will be replaced)
725   - cgtext, xxpos + widthtext + 0.015 , yypos,strtrim(!dustem_iter.act,2),color=0,/normal,charsize = 1.0,/addcmd & cmdind_x+=1
726   - ;saving the command id to replace it
727   - !dustemcgwin_ncmds.runs.pl = cmdind_x
728   -
729   - ;plotting of (mostly) fixed data for rchi2
730   - ;Since the format of the strings is specified, the length/width of the string in thex direction is fixed.
731   -
732   -
733   - ;Getting the width of the unrefreshed string
734   - widthtot=0.
735   - cgtext, xxpos, yypos,textoidl('\chi^{2} : '),color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
736   - widthtext = thiswidth
737   - widthtot+= thiswidth ;fixed width
738   -
739   - ;Getting the width of the refresh.ed string
740   - cgtext, xxpos, yypos,strtrim(string(chi2,format=frmt2),2),color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
741   - widthtot+= thiswidth;varying width
742   - ;saving the command string width to replace it
743   - !dustemcgwin_ncmds.chi2.txtwdth = thiswidth
744   -
745   -
746   - xxpos = 1.0 - widthtot - 0.03
747   -
748   - yypos = 0.97
749   -
750   - ;Displaying fixed part
751   - cgtext, xxpos, yypos,textoidl('\chi^{2} : '),color=0,/normal,charsize = 1.0,/addcmd & cmdind_x+=1
752   - ;Displaying refreshed part (first run . This is the command that will be replaced)
753   -
754   - cgtext, xxpos + widthtext , yypos,strtrim(string(chi2,format=frmt2),2),color=0,/normal,charsize = 1.0,/addcmd & cmdind_x+=1
755   -
756   - ;saving the command id to replace it
757   - !dustemcgwin_ncmds.chi2.pl = cmdind_x
758   -
759   -
760   -
761   - ;plotting of (mostly) fixed data for rchi2
762   -
763   - ;Getting the width of the unrefreshed string
764   - widthtot=0.
765   - cgtext, xxpos, yypos,textoidl('r_{\chi^{2}} : '),color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
766   - widthtext = thiswidth
767   - widthtot+= thiswidth ;fixed width
768   - ;!dustemcgwin_ncmds.rchi2.txtwdth1 = thiswidth
769   - ;Getting the width of the refreshed string
770   - cgtext, xxpos, yypos,strtrim(string(rchi2,format=frmt2),2),color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
771   - widthtot+= thiswidth;varying width
772   - !dustemcgwin_ncmds.rchi2.txtwdth = thiswidth
773   - ;These two lines will also have to be modified when plotting the refreshed values
774   - xxpos = 1.0 - widthtot - 0.03
775   - yypos = 0.95
776   -
777   - ;Displaying fixed part
778   - cgtext, xxpos, yypos,textoidl('r_{\chi^{2}} : '),color=0,/normal,charsize = 1.35,/addcmd & cmdind_x+=1
779   - ;Displaying refreshed part (first run . This is the command that will be replaced)
780   - cgtext, xxpos + widthtext , yypos,strtrim(string(rchi2,format=frmt2),2),color=0,/normal,charsize = 1.0,/addcmd & cmdind_x+=1
781   - ;saving the command id to replace it
782   - !dustemcgwin_ncmds.rchi2.pl = cmdind_x
783   -
784   -
785   - ;Plotting of the title of the dashboard (plot(s))
786   -
787   - ;NB: JP is right, the user should be able to set the entirety of the title.
788   - ;Make this block aware of the saving of the data (from the fits table)
789   -
790   -
791   - ;Getting the width of the title
792   - tit=string(_extra.title);
793 686  
794   - cgtext, 0.3, 0.95,tit+' (RUNNING)',color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
795   - widthtot = thiswidth
796   - xxpos = (1 - thiswidth)/2
797   - yypos = 0.96
798   -
799   - cgtext, 0.3, 0.95,tit,color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
800   - !dustemcgwin_ncmds.pltit.txtwdth = thiswidth*1.6 + (1 - widthtot)/2
801   -
802   - cgtext, xxpos, yypos,tit,color=0,/normal,charsize = 1.6,/addcmd & cmdind_x+=1
803   - xxpos+=thiswidth*1.6
804   - cgtext, xxpos, yypos,' (RUNNING)',color=0,/normal,charsize = 1.6,/addcmd & cmdind_x+=1
805   -
806   - !dustemcgwin_ncmds.pltit.pl = cmdind_x
807   -
808   - endif else begin
  687 + ;Plotting model string (legend)
  688 + xxpos = 0.015
  689 + yypos = 0.97
  690 + ;Plotting Hydrogen column density string (legend)
  691 + cgtext, xxpos, yypos,'Model : '+!dustem_model,color=0,/normal,charsize = 1.2;,/addcmd ;& cmdind_m+=1 This is the first command in the window
  692 + yypos = 0.95
  693 + cgtext, xxpos, yypos,textoidl('N_{H}')+textoidl(' (H/cm^2) : ')+strmid(string(*!dustem_HCD,format='(1E10.2)'),2),color=0,/normal,charsize = 1.2
809 694  
810   -
811   - winid_x = !dustemcgwin_id.ext
812   - cgcontrol, winid_x, execute=0
813   - cgset, winid_x ;apparently specifying the window index isn't enough. This might be because of the use of cgcontrol
814   -
815   - ;Refreshing chi2 data:
816   - cmdind_x = !dustemcgwin_ncmds.chi2.pl
817   - xxpos = 1 - !dustemcgwin_ncmds.chi2.txtwdth - 0.03
818   - yypos = 0.97
819   - cgwindow,'cgtext', xxpos , yypos,strtrim(string(chi2,format=frmt2),2),color=0,/normal,charsize = 1.0,/replacecmd,cmdindex=cmdind_x, winid=winid_x ;& cmdind_m+=1
820   -
821   -
822   -
823   - ;Refreshing rchi2 data:
824   - cmdind_x = !dustemcgwin_ncmds.rchi2.pl
825   - xxpos = 1 - !dustemcgwin_ncmds.rchi2.txtwdth - 0.03
826   - yypos = 0.95
827   - cgwindow,'cgtext', xxpos , yypos,strtrim(string(rchi2,format=frmt2),2),color=0,/normal,charsize = 1.0,/replacecmd,cmdindex=cmdind_x, winid=winid_x ;& cmdind_m+=1
828   -
829   -
830   - ;Refreshing number of runs data:
831   - cmdind_x = !dustemcgwin_ncmds.runs.pl
832   - xxpos = 0.03 + !dustemcgwin_ncmds.runs.txtwdth*1.35 ;(because of charsize)
833   - yypos = 0.015
834   - cgwindow,'cgtext', xxpos , yypos,strtrim(!dustem_iter.act,2),color=0,/normal,charsize = 1.0,/replacecmd,cmdindex=cmdind_x, winid=winid_x ;& cmdind_m+=1
835   -
836   -
837   - if !dustem_end EQ 1 then begin
838   - ;replacing my count - 3
839   - tit=!dustem_plot_extra.title
840   - cmdind_x = !dustemcgwin_ncmds.pltit.pl
841   -
842   - xxpos = !dustemcgwin_ncmds.pltit.txtwdth
843   - yypos = 0.96
844   -
845   - cgwindow,'cgtext', xxpos , yypos,' (Final Run)',color=0,/normal,charsize = 1.6,/replacecmd,cmdindex=cmdind_x, winid=winid_x
846   -
847   - endif
  695 + ;Plotting of the number of iterations completed by the fitter
848 696  
849   - endelse
  697 + ;Plotting of the number of runs
  698 + ;Getting the width of the unrefreshed string
  699 + widthtot=0.
  700 + ;cgtext, xxpos, yypos,'Runs : ',color=0,/normal,charsize=-1,width=thiswidth,/addcmd & cmdind_x+=1
  701 + cgtext, xxpos, yypos,'Iteration : ',color=0,/normal,charsize=-1,width=thiswidth
  702 + widthtext = thiswidth
  703 + widthtot+= thiswidth ;fixed width
  704 +
  705 + ;Getting the width of the refreshed string
  706 + cgtext, xxpos, yypos,strtrim(!dustem_iter.act,2),color=0,/normal,charsize=-1,width=thiswidth
  707 + widthtot+= thiswidth;varying width
  708 +
  709 + ;These two lines will also have to be modified when plotting the refreshed values
  710 + xxpos = 0.015 ;1.0 - widthtot - 0.03
  711 + yypos = 0.015
  712 +
  713 + ;Displaying fixed part
  714 + ;cgtext, xxpos, yypos,'Runs : ',color=0,/normal,charsize = 1.35,/addcmd & cmdind_x+=1
  715 + cgtext, xxpos, yypos,'Iteration : ',color=0,/normal,charsize = 1.35
  716 + ;Displaying refreshed part (first run . This is the command that will be replaced)
  717 + cgtext, xxpos + widthtext + 0.015 , yypos,strtrim(!dustem_iter.act,2),color=0,/normal,charsize = 1.0
  718 + ;saving the command id to replace it
  719 +
  720 +
  721 + ;plotting of (mostly) fixed data for rchi2
  722 + ;Since the format of the strings is specified, the length/width of the string in thex direction is fixed.
  723 +
  724 +
  725 + ;Getting the width of the unrefreshed string
  726 + widthtot=0.
  727 + cgtext, xxpos, yypos,textoidl('\chi^{2} : '),color=0,/normal,charsize=-1,width=thiswidth
  728 + widthtext = thiswidth
  729 + widthtot+= thiswidth ;fixed width
  730 +
  731 + ;Getting the width of the refresh.ed string
  732 + cgtext, xxpos, yypos,strtrim(string(chi2,format=frmt2),2),color=0,/normal,charsize=-1,width=thiswidth
  733 + widthtot+= thiswidth;varying width
  734 + ;saving the command string width to replace it
  735 +
  736 +
  737 + xxpos = 1.0 - widthtot - 0.03
  738 +
  739 + yypos = 0.97
  740 +
  741 + ;Displaying fixed part
  742 + cgtext, xxpos, yypos,textoidl('\chi^{2} : '),color=0,/normal,charsize = 1.0
  743 + ;Displaying refreshed part (first run . This is the command that will be replaced)
  744 +
  745 + cgtext, xxpos + widthtext , yypos,strtrim(string(chi2,format=frmt2),2),color=0,/normal,charsize = 1.0
  746 +
  747 + ;saving the command id to replace it
  748 +
  749 +
  750 +
  751 + ;plotting of (mostly) fixed data for rchi2
  752 +
  753 + ;Getting the width of the unrefreshed string
  754 + widthtot=0.
  755 + cgtext, xxpos, yypos,textoidl('r_{\chi^{2}} : '),color=0,/normal,charsize=-1,width=thiswidth
  756 + widthtext = thiswidth
  757 + widthtot+= thiswidth ;fixed width
  758 + ;!dustemcgwin_ncmds.rchi2.txtwdth1 = thiswidth
  759 + ;Getting the width of the refreshed string
  760 + cgtext, xxpos, yypos,strtrim(string(rchi2,format=frmt2),2),color=0,/normal,charsize=-1,width=thiswidth
  761 + widthtot+= thiswidth;varying width
  762 +
  763 + ;These two lines will also have to be modified when plotting the refreshed values
  764 + xxpos = 1.0 - widthtot - 0.03
  765 + yypos = 0.95
  766 +
  767 + ;Displaying fixed part
  768 + cgtext, xxpos, yypos,textoidl('r_{\chi^{2}} : '),color=0,/normal,charsize = 1.35
  769 + ;Displaying refreshed part (first run . This is the command that will be replaced)
  770 + cgtext, xxpos + widthtext , yypos,strtrim(string(rchi2,format=frmt2),2),color=0,/normal,charsize = 1.0
  771 + ;saving the command id to replace it
  772 +
  773 +
  774 + ;Plotting of the title of the dashboard (plot(s))
  775 +
  776 + ;NB: JP is right, the user should be able to set the entirety of the title.
  777 + ;Make this block aware of the saving of the data (from the fits table)
  778 +
  779 +
  780 + ;Getting the width of the title
  781 + tit=string(_extra.title);
  782 +
  783 + cgtext, 0.3, 0.95,tit+' (RUNNING)',color=0,/normal,charsize=-1,width=thiswidth
  784 + widthtot = thiswidth
  785 + xxpos = (1 - thiswidth)/2
  786 + yypos = 0.96
  787 +
  788 + cgtext, 0.3, 0.95,tit,color=0,/normal,charsize=-1,width=thiswidth
  789 +
  790 + cgtext, xxpos, yypos,tit,color=0,/normal,charsize = 1.6
  791 + xxpos+=thiswidth*1.6
  792 + cgtext, xxpos, yypos,' (RUNNING)',color=0,/normal,charsize = 1.6
  793 +
  794 +
  795 +; endif else begin
  796 +;
  797 +;
  798 +; winid_x = !dustemcgwin_id.ext
  799 +; cgcontrol, winid_x, execute=0
  800 +; cgset, winid_x ;apparently specifying the window index isn't enough. This might be because of the use of cgcontrol
  801 +;
  802 +; ;Refreshing chi2 data:
  803 +; cmdind_x = !dustemcgwin_ncmds.chi2.pl
  804 +; xxpos = 1 - !dustemcgwin_ncmds.chi2.txtwdth - 0.03
  805 +; yypos = 0.97
  806 +; cgwindow,'cgtext', xxpos , yypos,strtrim(string(chi2,format=frmt2),2),color=0,/normal,charsize = 1.0,/replacecmd,cmdindex=cmdind_x, winid=winid_x ;& cmdind_m+=1
  807 +;
  808 +;
  809 +;
  810 +; ;Refreshing rchi2 data:
  811 +; cmdind_x = !dustemcgwin_ncmds.rchi2.pl
  812 +; xxpos = 1 - !dustemcgwin_ncmds.rchi2.txtwdth - 0.03
  813 +; yypos = 0.95
  814 +; cgwindow,'cgtext', xxpos , yypos,strtrim(string(rchi2,format=frmt2),2),color=0,/normal,charsize = 1.0,/replacecmd,cmdindex=cmdind_x, winid=winid_x ;& cmdind_m+=1
  815 +;
  816 +;
  817 +; ;Refreshing number of runs data:
  818 +; cmdind_x = !dustemcgwin_ncmds.runs.pl
  819 +; xxpos = 0.03 + !dustemcgwin_ncmds.runs.txtwdth*1.35 ;(because of charsize)
  820 +; yypos = 0.015
  821 +; cgwindow,'cgtext', xxpos , yypos,strtrim(!dustem_iter.act,2),color=0,/normal,charsize = 1.0,/replacecmd,cmdindex=cmdind_x, winid=winid_x ;& cmdind_m+=1
  822 +;
  823 +;
  824 +; if !dustem_end EQ 1 then begin
  825 +; ;replacing my count - 3
  826 +; tit=!dustem_plot_extra.title
  827 +; cmdind_x = !dustemcgwin_ncmds.pltit.pl
  828 +;
  829 +; xxpos = !dustemcgwin_ncmds.pltit.txtwdth
  830 +; yypos = 0.96
  831 +;
  832 +; cgwindow,'cgtext', xxpos , yypos,' (Final Run)',color=0,/normal,charsize = 1.6,/replacecmd,cmdindex=cmdind_x, winid=winid_x
  833 +;
  834 +; endif
  835 +;
  836 +; endelse
850 837  
851 838 ;cgWindow_GetDefs,xsize=xsize,ysize=ysize
852 839 ;cgcontrol, resize=[xsize,ysize]
... ... @@ -896,32 +883,18 @@ if test_x then begin
896 883 ;This is not the right test the user might want to show the prediction for sed and fit the stokes parameters
897 884 if ~test_ext then begin ; EXT data is not present (For completeness) # This is only valid when !run_pol=1
898 885  
899   - cgwindow,'dustemcgwin_dataset', st, dataset='EXT', /nodata, position=p_ext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
900   - cgwindow,'dustemcgwin_dataset', st, dataset='EXT', /nodata, /norm, position=np_ext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
  886 + dustemcgwin_dataset, st, dataset='EXT', /nodata, position=p_ext, _extra=_extra
  887 + dustemcgwin_dataset, st, dataset='EXT', /nodata, /norm, position=np_ext, _extra=_extra
901 888  
902 889 endif else begin ;EXT exists
903   -
904   - if ~iswinext then begin
905   -
906   - cmdind_x = !dustemcgwin_ncmds.ext.pl
907   - cgwindow,'dustemcgwin_dataset', st, dustem_ext,EXT_spec,dataset='EXT', /refresh ,position=p_ext, winid=winid_x,cmdindex=cmdind_x,/replacecmd,_extra=_extra
908   -
909   - cmdind_x = !dustemcgwin_ncmds.ext.nrm
910   - cgwindow,'dustemcgwin_dataset', st, dustem_ext,EXT_spec,dataset='EXT', /norm, /refresh,position=np_ext, winid=winid_x,cmdindex=cmdind_x,/replacecmd,_extra=_extra
911   -
912   -
913   - endif else begin
914 890  
915   - cgwindow,'dustemcgwin_dataset', st, dataset='EXT', position=p_ext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
916   - cgwindow,'dustemcgwin_dataset', st, dustem_ext,EXT_spec, dataset='EXT', /refresh ,position=p_ext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
917   - !dustemcgwin_ncmds.ext.pl = cmdind_x
918   -
919   - cgwindow,'dustemcgwin_dataset', st, dataset='EXT',/norm, position=np_ext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1 ;I think nodata can also be used too
920   -
921   - cgwindow,'dustemcgwin_dataset', st, dustem_ext,EXT_spec, dataset='EXT', /norm, /refresh,position=np_ext, /addcmd ,winid=winid_x, _extra=_extra & cmdind_x+=1
922   - !dustemcgwin_ncmds.ext.nrm = cmdind_x
923   -
924   - endelse
  891 + dustemcgwin_dataset, st, dataset='EXT', position=p_ext, _extra=_extra
  892 + dustemcgwin_dataset, st, dustem_ext,EXT_spec, dataset='EXT', /refresh ,position=p_ext, _extra=_extra
  893 +
  894 + dustemcgwin_dataset, st, dataset='EXT',/norm, position=np_ext, _extra=_extra ;I think nodata can also be used too
  895 +
  896 + dustemcgwin_dataset, st, dustem_ext,EXT_spec, dataset='EXT', /norm, /refresh,position=np_ext, _extra=_extra
  897 +
925 898 endelse
926 899  
927 900  
... ... @@ -929,195 +902,114 @@ if test_x then begin
929 902  
930 903 if ~test_qext then begin ;Qext is not present
931 904  
932   - cgwindow,'dustemcgwin_dataset', st, dataset='QEXT', /nodata, position=p_qext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
933   - cgwindow,'dustemcgwin_dataset', st, dataset='QEXT', /nodata, /norm, position=np_qext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
  905 + dustemcgwin_dataset, st, dataset='QEXT', /nodata, position=p_qext, _extra=_extra
  906 + dustemcgwin_dataset, st, dataset='QEXT', /nodata, /norm, position=np_qext, _extra=_extra
934 907  
935 908 endif else begin ;Qext data is present
936   -
937   - if ~iswinext then begin
938   - cmdind_x = !dustemcgwin_ncmds.qext.pl
939   - ;refreshing the positive_only and negative_only plots if data is present in them
940   - cgwindow,'dustemcgwin_dataset', st, dustem_qext,QEXT_spec,dataset='QEXT',/positive_only, nodata=0, /refresh ,position=p_qext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
941   -
942   - cgwindow,'dustemcgwin_dataset', st, dustem_qext,QEXT_spec, dataset='QEXT',/negative_only, nodata=0, /refresh ,position=p_qext, winid=winid_x,/replacecmd,cmdindex=cmdind_x+2, _extra=_extra
943   -
944   - cmdind_x = !dustemcgwin_ncmds.qext.nrm
945   - cgwindow,'dustemcgwin_dataset', st, dustem_qext,QEXT_spec, dataset='QEXT', /refresh, nodata=0, /norm,position=np_qext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
946   -
947   - endif else begin
948   -
949   - ;Plotting of postive values if they exist (if hidden data is present it is plotted if not an empty plot is rendered)
950   - cgwindow,'dustemcgwin_dataset', st, dataset='QEXT', position=p_qext, /addcmd, winid=winid_x,/positive_only, _extra=_extra & cmdind_x+=1
951   - ;Refreshing the positive_only plot ONLY if there is data. If not do nothing
952   -
953   - cgwindow,'dustemcgwin_dataset', st, dustem_qext,QEXT_spec, dataset='QEXT',/positive_only, /refresh ,position=p_qext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
954   -
955   - !dustemcgwin_ncmds.qext.pl = cmdind_x
956   -
957   - cgwindow,'dustemcgwin_dataset', st, dataset='QEXT', position=p_qext, /addcmd, winid=winid_x,/negative_only, _extra=_extra & cmdind_x+=1
958   - ;Refreshing the negative_only plot ONLY if there is data. If not do nothing
959   - cgwindow,'dustemcgwin_dataset', st, dustem_qext,QEXT_spec,dataset='QEXT',/negative_only, /refresh ,position=p_qext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
  909 +
  910 + ;Plotting of postive values if they exist (if hidden data is present it is plotted if not an empty plot is rendered)
  911 + dustemcgwin_dataset, st, dataset='QEXT', position=p_qext,/positive_only, _extra=_extra
  912 + ;Refreshing the positive_only plot ONLY if there is data. If not do nothing
960 913  
961   - cgwindow,'dustemcgwin_dataset', st, dataset='QEXT',/norm, position=np_qext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1 ;I think nodata can also be uqsed too
962   - cgwindow,'dustemcgwin_dataset', st, dustem_qext,QEXT_spec,dataset='QEXT', /norm, /refresh,position=np_qext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
963   - !dustemcgwin_ncmds.qext.nrm = cmdind_x
964   -
965   - endelse
  914 + dustemcgwin_dataset, st, dustem_qext,QEXT_spec, dataset='QEXT',/positive_only, /refresh ,position=p_qext, _extra=_extra
  915 +
  916 + dustemcgwin_dataset, st, dataset='QEXT', position=p_qext,/negative_only, _extra=_extra
  917 + ;Refreshing the negative_only plot ONLY if there is data. If not do nothing
  918 + dustemcgwin_dataset, st, dustem_qext,QEXT_spec,dataset='QEXT',/negative_only, /refresh ,position=p_qext, _extra=_extra
  919 +
  920 + dustemcgwin_dataset, st, dataset='QEXT',/norm, position=np_qext, _extra=_extra ;I think nodata can also be uqsed too
  921 + dustemcgwin_dataset, st, dustem_qext,QEXT_spec,dataset='QEXT', /norm, /refresh,position=np_qext, _extra=_extra
  922 +
966 923 endelse
967 924 ;stop
968 925 if ~test_uext then begin ;uext is not present
969 926  
970   - cgwindow,'dustemcgwin_dataset', st, dataset='UEXT', /nodata, position=p_uext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
971   - cgwindow,'dustemcgwin_dataset', st, dataset='UEXT', /nodata, /norm, position=np_uext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
  927 + dustemcgwin_dataset, st, dataset='UEXT', /nodata, position=p_uext, _extra=_extra
  928 + dustemcgwin_dataset, st, dataset='UEXT', /nodata, /norm, position=np_uext, _extra=_extra
972 929  
973 930 endif else begin ;uext data is present
974   -
975   - if ~iswinext then begin
976   - cmdind_x = !dustemcgwin_ncmds.uext.pl
977   - ;refreshing the positive_only and negative_only plots if data is present in them
978   - cgwindow,'dustemcgwin_dataset', st, dustem_uext,UEXT_spec, dataset='UEXT',/positive_only, nodata=0, /refresh ,position=p_uext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
979   -
980   - cgwindow,'dustemcgwin_dataset', st, dustem_uext,UEXT_spec, dataset='UEXT',/negative_only, nodata=0, /refresh ,position=p_uext, winid=winid_x,/replacecmd,cmdindex=cmdind_x+2, _extra=_extra
981   -
982   - cmdind_x = !dustemcgwin_ncmds.uext.nrm
983   - cgwindow,'dustemcgwin_dataset', st, dustem_uext,UEXT_spec, dataset='UEXT', /refresh, nodata=0, /norm,position=np_uext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
984   -
985   - endif else begin
  931 +
986 932 ;stop
987 933 ;Plotting of postive values if they exist (if hidden data is present it is plotted if not an empty plot is rendred)
988   - cgwindow,'dustemcgwin_dataset', st, dataset='UEXT', position=p_uext, /addcmd, winid=winid_x,/positive_only, _extra=_extra & cmdind_x+=1
  934 + dustemcgwin_dataset, st, dataset='UEXT', position=p_uext,/positive_only, _extra=_extra
989 935  
990 936 ;Refreshing the positive_only plot ONLY if there is data. If not do nothing
991   - cgwindow,'dustemcgwin_dataset', st, dustem_uext,UEXT_spec, dataset='UEXT',/positive_only, /refresh ,position=p_uext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
992   -
993   - !dustemcgwin_ncmds.uext.pl = cmdind_x
  937 + dustemcgwin_dataset, st, dustem_uext,UEXT_spec, dataset='UEXT',/positive_only, /refresh ,position=p_uext, _extra=_extra
994 938  
995   - cgwindow,'dustemcgwin_dataset', st, dataset='UEXT', position=p_uext, /addcmd, winid=winid_x,/negative_only, _extra=_extra & cmdind_x+=1
  939 +
  940 + dustemcgwin_dataset, st, dataset='UEXT', position=p_uext,/negative_only, _extra=_extra
996 941 ;Refreshing the negative_only plot ONLY if there is data. If not do nothing
997   - cgwindow,'dustemcgwin_dataset', st, dustem_uext,UEXT_spec, dataset='UEXT',/negative_only, /refresh ,position=p_uext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
998   -
  942 + dustemcgwin_dataset, st, dustem_uext,UEXT_spec, dataset='UEXT',/negative_only, /refresh ,position=p_uext, _extra=_extra
999 943  
1000   - cgwindow,'dustemcgwin_dataset', st, dataset='UEXT',/norm, position=np_uext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1 ;I think nodata can also be uused too
1001   - cgwindow,'dustemcgwin_dataset', st, dustem_uext,UEXT_spec, dataset='UEXT', /norm, /refresh,position=np_uext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1002   - !dustemcgwin_ncmds.uext.nrm = cmdind_x
1003 944  
1004   - endelse
  945 + dustemcgwin_dataset, st, dataset='UEXT',/norm, position=np_uext, _extra=_extra ;I think nodata can also be uused too
  946 + dustemcgwin_dataset, st, dustem_uext,UEXT_spec, dataset='UEXT', /norm, /refresh,position=np_uext, _extra=_extra
  947 +
  948 +
1005 949 endelse
1006 950  
1007 951 if ~test_psi_ext then begin ; psi_ext data is not present (For completeness) # This is only valid when !run_pol=1
1008 952  
1009   - cgwindow,'dustemcgwin_dataset', st, dataset='PSI_EXT', /nodata, position=p_psiext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
  953 + dustemcgwin_dataset, st, dataset='PSI_EXT', /nodata, position=p_psiext, _extra=_extra
1010 954  
1011 955 endif else begin ;psi_ext exists
1012 956  
1013   - if ~iswinext then begin
1014   - cmdind_x = !dustemcgwin_ncmds.psi_ext.pl
1015   - cgwindow,'dustemcgwin_dataset', st, dustem_psi_ext,PSIEXT_spec, dataset='PSI_EXT', /refresh ,position=p_psiext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
  957 + dustemcgwin_dataset, st, dataset='psi_ext', position=p_psiext, _extra=_extra
  958 + dustemcgwin_dataset, st, dustem_psi_ext,PSIEXT_spec, dataset='psi_ext', /refresh ,position=p_psiext, _extra=_extra
  959 +
1016 960  
1017   - endif else begin
1018   - ;stop
1019   - cgwindow,'dustemcgwin_dataset', st, dataset='psi_ext', position=p_psiext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1020   - cgwindow,'dustemcgwin_dataset', st, dustem_psi_ext,PSIEXT_spec, dataset='psi_ext', /refresh ,position=p_psiext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1021   - !dustemcgwin_ncmds.psi_ext.pl = cmdind_x
1022   -
1023   - endelse
1024 961 endelse
1025 962  
1026 963  
1027 964 if ~test_polext then begin ; polext data is not present (For completeness) # This is only valid when !run_pol=1
1028 965  
1029   - cgwindow,'dustemcgwin_dataset', st, dataset='polext', /nodata, position=p_pext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1030   - cgwindow,'dustemcgwin_dataset', st, dataset='polext', /nodata, /norm, position=np_pext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
  966 + dustemcgwin_dataset, st, dataset='polext', /nodata, position=p_pext, _extra=_extra
  967 + dustemcgwin_dataset, st, dataset='polext', /nodata, /norm, position=np_pext, _extra=_extra
1031 968  
1032 969 endif else begin ;polext exists
1033 970  
1034   - if ~iswinext then begin
1035   - cmdind_x = !dustemcgwin_ncmds.polext.pl
1036   - cgwindow,'dustemcgwin_dataset', st, dustem_polext,POLEXT_spec, dataset='polext', /refresh ,position=p_pext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
1037   - cmdind_x = !dustemcgwin_ncmds.polext.nrm
1038   - cgwindow,'dustemcgwin_dataset', st, dustem_polext,POLEXT_spec, dataset='polext', /norm, /refresh,position=np_pext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
1039   - endif else begin
1040   - ;stop
1041   - cgwindow,'dustemcgwin_dataset', st, dataset='polext', position=p_pext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1042   - cgwindow,'dustemcgwin_dataset', st, dustem_polext,POLEXT_spec, dataset='polext', /refresh ,position=p_pext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1043   - !dustemcgwin_ncmds.polext.pl = cmdind_x
1044   - cgwindow,'dustemcgwin_dataset', st, dataset='polext',/norm, position=np_pext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1 ;I think nodata can also be upolsed too
1045   - cgwindow,'dustemcgwin_dataset', st, dustem_polext,POLEXT_spec, dataset='polext', /norm, /refresh,position=np_pext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1046   - !dustemcgwin_ncmds.polext.nrm = cmdind_x
1047   - endelse
  971 + dustemcgwin_dataset, st, dataset='polext', position=p_pext, _extra=_extra
  972 + dustemcgwin_dataset, st, dustem_polext,POLEXT_spec, dataset='polext', /refresh ,position=p_pext, _extra=_extra
  973 +
  974 + dustemcgwin_dataset, st, dataset='polext',/norm, position=np_pext, _extra=_extra ;I think nodata can also be upolsed too
  975 + dustemcgwin_dataset, st, dustem_polext,POLEXT_spec, dataset='polext', /norm, /refresh,position=np_pext, _extra=_extra
  976 +
1048 977 endelse
1049 978  
1050 979  
1051 980 if ~test_fpolext then begin ; fpolext data is not present (For completeness) # This is only valid when !run_pol=1
1052 981  
1053   - cgwindow,'dustemcgwin_dataset', st, dataset='fpolext', /nodata, position=p_spext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
  982 + dustemcgwin_dataset, st, dataset='fpolext', /nodata, position=p_spext, _extra=_extra
  983 +
1054 984  
1055 985 endif else begin ;fpolext exists
1056 986  
1057   - if ~iswinext then begin
1058   - cmdind_x = !dustemcgwin_ncmds.fpolext.pl
1059   - cgwindow,'dustemcgwin_dataset', st, dustem_fpolext,SPEXT_spec,EXT_spec, dataset='fpolext', /refresh ,position=p_spext, winid=winid_x,/replacecmd,cmdindex=cmdind_x, _extra=_extra
1060   -
1061   - endif else begin
1062   -
1063   - cgwindow,'dustemcgwin_dataset', st, dataset='fpolext', position=p_spext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1064   - cgwindow,'dustemcgwin_dataset', st, dustem_fpolext,SPEXT_spec,EXT_spec, dataset='fpolext', /refresh ,position=p_spext, /addcmd, winid=winid_x, _extra=_extra & cmdind_x+=1
1065   - !dustemcgwin_ncmds.fpolext.pl = cmdind_x
  987 +
  988 + dustemcgwin_dataset, st, dataset='fpolext', position=p_spext, _extra=_extra
  989 + dustemcgwin_dataset, st, dustem_fpolext,SPEXT_spec,EXT_spec, dataset='fpolext', /refresh ,position=p_spext, _extra=_extra
  990 +
1066 991  
1067   - endelse
1068 992 endelse
1069 993  
1070 994  
1071 995 ENDIF
1072 996  
1073   - cgcontrol, winid_x, execute=1
1074 997  
1075 998  
1076 999 ENDIF
1077 1000  
1078 1001  
1079   -; IF ~iswinprms THEN BEGIN;(NEXT RUNS)
1080   -;
1081   -; winid_prms = !dustemcgwin_id.prms
1082   -; cgcontrol, winid_prms, execute=0
1083   -; cgset, winid_prms
1084   -; cmdind_prms = !dustemcgwin_ncmds.prms.pl
1085   -; cgwindow,'dustemcgwin_dataset', st, res, errors, p_dim,dataset='PARAMETERS', /refresh, winid=winid_prms,/replacecmd,cmdindex=cmdind_prms, _extra=_extra
1086   -; cgcontrol, winid_prms ,execute=1
1087   -; ENDIF ELSE BEGIN ;(FIRST RUN)
1088   - window,1,xpos=param_wxpos,ypos=param_wypos,xsize=param_wxsize,ysize=param_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (PARAMETERS)' ; keeping the same y dimension of the emission/extinction plot?
1089   -; cgwindow,wxsize=350,wysize=200,wtitle='DUSTEMWRAP v2.0 (PARAMETERS)' ; keeping the same y dimension of the emission/extinction plot?
1090   - winid_prms = cgquery(dimensions=dim_prms,/current) ;we don't need the dimension of the window so far/ I don't know why I needed it before
1091   - cgcontrol, winid_prms, execute=0
1092   - ;!dustemcgwin_id.prms = winid_prms
1093   - dustemcgwin_dataset, st, res, errors, p_dim,dataset='PARAMETERS',_extra=_extra ;& cmdind_prms+=1
1094   - dustemcgwin_dataset, st, res, errors, p_dim,dataset='PARAMETERS',/refresh, _extra=_extra
1095   - ;!dustemcgwin_ncmds.prms.pl = cmdind_prms
1096   - cgcontrol, winid_prms ,execute=1
1097   -; ENDELSE
1098   -
  1002 +;PLOTTING OF THE PARAMETERS
  1003 +window,2,xpos=param_wxpos,ypos=param_wypos,xsize=param_wxsize,ysize=param_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (PARAMETERS)' ; keeping the same y dimension of the emission/extinction plot?
  1004 +dustemcgwin_dataset, st, res, errors, p_dim,dataset='PARAMETERS',_extra=_extra ;& cmdind_prms+=1
  1005 +dustemcgwin_dataset, st, res, errors, p_dim,dataset='PARAMETERS',/refresh, _extra=_extra
1099 1006  
  1007 +;PLOTTING OF THE PLUGINS
1100 1008 IF (tag_names(*!dustem_plugin))(0) NE 'NONE' THEN BEGIN
1101   -
1102   -; IF ~iswinplgns THEN BEGIN;(NEXT RUNS)
1103   -;
1104   -; winid_plgns = !dustemcgwin_id.plgns
1105   -; cgcontrol, winid_plgns, execute=0
1106   -; cgset, winid_plgns
1107   -; cmdind_plgns = !dustemcgwin_ncmds.plgns.pl
1108   -; cgwindow,'dustemcgwin_dataset', st, res, errors, p_dim,dataset='PLUGINS', /refresh, winid=winid_plgns,/replacecmd,cmdindex=cmdind_plgns, _extra=_extra
1109   -; cgcontrol, winid_plgns ,execute=1
1110   -; ENDIF ELSE BEGIN ;(FIRST RUN)
1111   - window,2,xpos=plugin_wxpos,ypos=plugin_wypos,xsize=plugin_wxsize,ysize=plugin_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (PLUGINS)' ; keeping the same y dimension of the emission/extinction plot?
1112   - ;cgwindow,wxsize=350,wysize=200,wtitle='DUSTEMWRAP v2.0 (PLUGINS)' ; keeping the same y dimension of the emission/extinction plot?
1113   - winid_plgns = cgquery(dimensions=dim_plgns,/current) ;we don't need the dimension of the window so far/ I don't know why I needed it before
1114   - cgcontrol, winid_plgns, execute=0
1115   - ;!dustemcgwin_id.plgns = winid_plgns
1116   - dustemcgwin_dataset, st, res, errors, p_dim,dataset='PLUGINS',_extra=_extra ;& cmdind_prms+=1
1117   - dustemcgwin_dataset, st, res, errors, p_dim,dataset='PLUGINS', /refresh , winid=winid_plgns, _extra=_extra
1118   - ;!dustemcgwin_ncmds.plgns.pl = cmdind_plgns
1119   - cgcontrol, winid_plgns ,execute=1
1120   -; ENDELSE
  1009 +
  1010 + window,3,xpos=plugin_wxpos,ypos=plugin_wypos,xsize=plugin_wxsize,ysize=plugin_wysize,title='DUSTEMWRAP '+!dustem_version.version+' (PLUGINS)' ; keeping the same y dimension of the emission/extinction plot?
  1011 + dustemcgwin_dataset, st, res, errors, p_dim,dataset='PLUGINS',_extra=_extra ;& cmdind_prms+=1
  1012 + dustemcgwin_dataset, st, res, errors, p_dim,dataset='PLUGINS', /refresh , winid=winid_plgns, _extra=_extra
1121 1013  
1122 1014 ENDIF
1123 1015  
... ...