cytan299 / tribahtinov

A Tri-Bahtinov Mask for Aiding Collimation and Focusing of Schmidt Cassegrain, Ritchey-Chretien, and Newtonian Telescopes
58 stars 10 forks source link

The pitch of the diffraction grating becomes thick #4

Closed satakagi closed 7 years ago

satakagi commented 7 years ago

I noticed that the diffraction grating pitch generated by the webApps version tri-bahtinov mask generator is thicker than the conventional bahtinov mask generator on this site.

According to the cloudy nights thread that that site refers to, the expression that determines the width (pitch) of the diffraction grating is explained as follows. s = f / 150 Where s is the sum of slit and uncut space, f is focal length, 150 is bahtinov factor.

According to the following part of generate.py, spacing = (tri_stem_w + tri_w); -> Line 112, 217, 342 I interpreted that the variable equivalent to s is spacing, the variable equivalent to slit is tri_w, and the variable corresponding to uncut space is tri_stem_w.

The formula for determining the width of the diffraction grating would be: spacing = focal_length / BAHTINOV_FACTOR

On the other hand, according to the following part of generate.py, Tri_w = focal_length / BAHTINOV_FACTOR; -> Line 567 tri_w, rather than spacing, is generated by that expression. As a result, it seems that spacing is calculated to be large by tri_stem_w.

I have not tested it because I can not prepare the python execution environment, but it might be able to fix it by doing as follows.

567c567,572
< tri_w = focal_length/BAHTINOV_FACTOR;
---
> spacing = focal_length/BAHTINOV_FACTOR;
> if ( spacing - tri_stem_w > tri_stem_w * 0.5 ) :
>     tri_w = spacing - tri_stem_w
> else:
>     tri_w = spacing / 3;
>     tri_stem_w = 2 * spacing / 3;
cytan299 commented 7 years ago

Hi Satoru,   Hmmm, you might be right. You're the first person to actually check out the code. I'll have a look at it tonight and get back to you. cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Sent: Monday, June 19, 2017 6:59 AM Subject: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

I noticed that the diffraction grating pitch generated by the webApps version tri-bahtinov mask generator is thicker than the conventional bahtinov mask generator on this site.According to the cloudy nights thread that that site refers to, the expression that determines the width (pitch) of the diffraction grating is explained as follows. s = f / 150 Where s is the sum of slit and uncut space, f is focal length, 150 is bahtinov factor.According to the following part of generate.py, spacing = (tri_stem_w + tri_w); -> Line 112, 217, 342 I interpreted that the variable equivalent to s is spacing, the variable equivalent to slit is tri_w, and the variable corresponding to uncut space is tri_stem_w.The formula for determining the width of the diffraction grating would be: spacing = focal_length / BAHTINOV_FACTOROn the other hand, according to the following part of generate.py, Tri_w = focal_length / BAHTINOV_FACTOR; -> Line 567 tri_w, rather than spacing, is generated by that expression. As a result, it seems that spacing is calculated to be large by tri_stem_w.I have not tested it because I can not prepare the python execution environment, but it might be able to fix it by doing as follows.567c567,572 < tri_w = focal_length/BAHTINOV_FACTOR;

spacing = focal_length/BAHTINOV_FACTOR; if ( spacing - tri_stem_w > tri_stem_w 0.5 ) : tri_w = spacing - tri_stem_w else: tri_w = spacing / 3; tri_stem_w = 2 spacing / 3; — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

cytan299 commented 7 years ago

Hi Satoru,   I patched generate.py using your diff enclosed in your message. See generate_satoru.py. Unfortunately, the mask that it generates looks like this:

which has slots that are too thin. The input is: focal length = 1000 mmouter radius = 4 ininner radius = 1.5 in. Here is the Bahtinov mask generated using the astrojargon bahtinov mask generator:

which was generated with the attached file. I will try to look at the code more carefully over the weekend. cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Sent: Monday, June 19, 2017 6:59 AM Subject: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

I noticed that the diffraction grating pitch generated by the webApps version tri-bahtinov mask generator is thicker than the conventional bahtinov mask generator on this site.According to the cloudy nights thread that that site refers to, the expression that determines the width (pitch) of the diffraction grating is explained as follows. s = f / 150 Where s is the sum of slit and uncut space, f is focal length, 150 is bahtinov factor.According to the following part of generate.py, spacing = (tri_stem_w + tri_w); -> Line 112, 217, 342 I interpreted that the variable equivalent to s is spacing, the variable equivalent to slit is tri_w, and the variable corresponding to uncut space is tri_stem_w.The formula for determining the width of the diffraction grating would be: spacing = focal_length / BAHTINOV_FACTOROn the other hand, according to the following part of generate.py, Tri_w = focal_length / BAHTINOV_FACTOR; -> Line 567 tri_w, rather than spacing, is generated by that expression. As a result, it seems that spacing is calculated to be large by tri_stem_w.I have not tested it because I can not prepare the python execution environment, but it might be able to fix it by doing as follows.567c567,572 < tri_w = focal_length/BAHTINOV_FACTOR;

spacing = focal_length/BAHTINOV_FACTOR; if ( spacing - tri_stem_w > tri_stem_w 0.5 ) : tri_w = spacing - tri_stem_w else: tri_w = spacing / 3; tri_stem_w = 2 spacing / 3; — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

satakagi commented 7 years ago

Hi, cytan, By the above patch, spacing (which is the sum of slit and uncut space) rather than tri_w (slit width) is calculated from BAHTINOV_FACTOR. As in the following equation spacing = focal_length / BAHTINOV_FACTOR; On the other hand, tri_stem_w (uncut space) was fixed at 0.2362 inches. Therefore, when the spacing becomes smaller, the width of the slit (slot) becomes narrower.

So, I added an option to make tri_stem_w variable by specifying the ratio of the width of the slit and uncut space similar to that of the webApps I ported.

For the time being, I tested roughly this new patch by building a python execution environment on my PC.

567c567,583
< tri_w = focal_length/BAHTINOV_FACTOR;
---
> variable_stem = raw_input("Do you use variable stem width? (y/n):");
> if ( variable_stem == "y" ) :
>     w_stem_ratio = input("Enter slit:stem ratio 1:");
>     print "slit:stem = 1:",w_stem_ratio;
> else:
>     w_stem_ratio = 0;
> 
> spacing = focal_length/BAHTINOV_FACTOR;
> if ( w_stem_ratio == 0 ):
>     if ( spacing - tri_stem_w > tri_stem_w * 0.5 ) :
>         tri_w = spacing - tri_stem_w
>     else:
>         tri_w = spacing / 3;
>         tri_stem_w = 2 * spacing / 3;
> else:
>     tri_w = spacing / ( w_stem_ratio + 1 );
>     tri_stem_w = w_stem_ratio * spacing / ( w_stem_ratio + 1 );
cytan299 commented 7 years ago

Hi Satoru,   Thanks! Let me try it out again tonight. cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: cytan299 cytan299@yahoo.com; Comment comment@noreply.github.com Sent: Tuesday, June 20, 2017 9:26 AM Subject: Re: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

Hi, cytan, By the above patch, spacing (which is the sum of slit and uncut space) rather than tri_w (slit width) is calculated from BAHTINOV_FACTOR. As in the following equation spacing = focal_length / BAHTINOV_FACTOR; On the other hand, tri_stem_w (uncut space) was fixed at 0.2362 inches. Therefore, when the spacing becomes smaller, the width of the slit (slot) becomes narrower.So, I added an option to make tri_stem_w variable by specifying the ratio of the width of the slit and uncut space similar to that of the webApps I ported.For the time being, I tested roughly this new patch by building a python execution environment on my PC.567c567,583 < tri_w = focal_length/BAHTINOV_FACTOR;

variable_stem = raw_input("Do you use variable stem width? (y/n):"); if ( variable_stem == "y" ) : w_stem_ratio = input("Enter slit:stem ratio 1:"); print "slit:stem = 1:",w_stem_ratio; else: w_stem_ratio = 0;

spacing = focal_length/BAHTINOV_FACTOR; if ( w_stem_ratio == 0 ): if ( spacing - tri_stem_w > tri_stem_w 0.5 ) : tri_w = spacing - tri_stem_w else: tri_w = spacing / 3; tri_stem_w = 2 spacing / 3; else: tri_w = spacing / ( w_stem_ratio + 1 ); tri_stem_w = w_stem_ratio * spacing / ( w_stem_ratio + 1 ); — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

cytan299 commented 7 years ago

Hi Satoru,   Thanks for the update. I think there's still something weird going on with the spacing/slit size when compared to the mask that is generated by astrojargon. Let me look at it over the weekend and then I will get back to you. cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: cytan299 cytan299@yahoo.com; Comment comment@noreply.github.com Sent: Tuesday, June 20, 2017 9:26 AM Subject: Re: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

Hi, cytan, By the above patch, spacing (which is the sum of slit and uncut space) rather than tri_w (slit width) is calculated from BAHTINOV_FACTOR. As in the following equation spacing = focal_length / BAHTINOV_FACTOR; On the other hand, tri_stem_w (uncut space) was fixed at 0.2362 inches. Therefore, when the spacing becomes smaller, the width of the slit (slot) becomes narrower.So, I added an option to make tri_stem_w variable by specifying the ratio of the width of the slit and uncut space similar to that of the webApps I ported.For the time being, I tested roughly this new patch by building a python execution environment on my PC.567c567,583 < tri_w = focal_length/BAHTINOV_FACTOR;

variable_stem = raw_input("Do you use variable stem width? (y/n):"); if ( variable_stem == "y" ) : w_stem_ratio = input("Enter slit:stem ratio 1:"); print "slit:stem = 1:",w_stem_ratio; else: w_stem_ratio = 0;

spacing = focal_length/BAHTINOV_FACTOR; if ( w_stem_ratio == 0 ): if ( spacing - tri_stem_w > tri_stem_w 0.5 ) : tri_w = spacing - tri_stem_w else: tri_w = spacing / 3; tri_stem_w = 2 spacing / 3; else: tri_w = spacing / ( w_stem_ratio + 1 ); tri_stem_w = w_stem_ratio * spacing / ( w_stem_ratio + 1 ); — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

satakagi commented 7 years ago

Thank you for checking. In the case of a focal length of 1000 mm, the sum of slit and uncut space is (1000/150) = 6.6 mm according to the calculation formula, and the result of astrojargon is almost equal to that. (However, the common focal length of the 8-inch Schmidt Cassegrain is about 2000 mm.)

I measured the result when setting the same focal length in patched generate.py with inkscape and got the same result.

I also made revisions to webApps that made similar changes to the above patch as follows. Http://svg2.mbsrv.net/astro/Tri-Bahtinov_r3.html

Same results (sum of slit and uncut space = 6.6 mm) were obtained by setting the same parameters (focal length = 1000 mm) for this modified webApps.

cytan299 commented 7 years ago

Hi Satoru,  Thanks for going through the numbers so carefully! Let me do the same this evening and I'll get back to you. cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: cytan299 cytan299@yahoo.com; Comment comment@noreply.github.com Sent: Wednesday, June 21, 2017 6:46 AM Subject: Re: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

Thank you for checking. In the case of a focal length of 1000 mm, the sum of slit and uncut space is (1000/150) = 6.6 mm according to the calculation formula, and the result of astrojargon is almost equal to that. (However, the common focal length of the 8-inch Schmidt Cassegrain is about 2000 mm.)I measured the result when setting the same focal length in patched generate.py with inkscape and got the same result.I also made revisions to webApps that made similar changes to the above patch as follows. Http://svg2.mbsrv.net/astro/Tri-Bahtinov_r3.htmlThe width obtained by adding the same slit and uncut space obtained by setting the same focal length (1000 mm) here was also 6.6 mm.— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

cytan299 commented 7 years ago

Hi Satoru,   I've gone through your webapps program, the patched generate.py and astrojargon bahtinov mask generator. I see that the webapps and generate.py agree. And astrojargon agrees if the ratios are the same as that used in generate.py and webapps.  Unfortunately, I see that the problem is with my default stemwidth of 0.2362 inches. I think this default should be removed as an option. What do you think? cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: cytan299 cytan299@yahoo.com; Comment comment@noreply.github.com Sent: Wednesday, June 21, 2017 6:46 AM Subject: Re: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

Thank you for checking. In the case of a focal length of 1000 mm, the sum of slit and uncut space is (1000/150) = 6.6 mm according to the calculation formula, and the result of astrojargon is almost equal to that. (However, the common focal length of the 8-inch Schmidt Cassegrain is about 2000 mm.)I measured the result when setting the same focal length in patched generate.py with inkscape and got the same result.I also made revisions to webApps that made similar changes to the above patch as follows. Http://svg2.mbsrv.net/astro/Tri-Bahtinov_r3.htmlThe width obtained by adding the same slit and uncut space obtained by setting the same focal length (1000 mm) here was also 6.6 mm.— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

satakagi commented 7 years ago

Hi, cytan, In astrojargon, the width of slit and uncut space can always be set equal only, whereas patched generate.py and its webApps version have a richer function that can specify the width ratio. On the other hand, I think that it would be preferable to be able to set the width of the "inner support" which is the stem between the center hole and the slits independently, considering the mechanical strength. And I think that it is appropriate that the value is about 0.2362 inch. The draft of the patch is as follows.

94a95
> tri_in_w = 0.2362*INCH2PIXELS; # inches, width of the inner support
567c568,589
< tri_w = focal_length/BAHTINOV_FACTOR;
---
> fixed_stem = raw_input("Do you use fixed stem width? (y/N):");
> if ( fixed_stem == "y" ) :
>     w_stem_ratio = 0;
>     print "fixed stem width:",tri_stem_w/INCH2PIXELS,"in";
> else:
>     set_stem_ratio = raw_input("Do you set slit:stem ratio? (y/N):");
>     if ( set_stem_ratio == "y" ) :
>         w_stem_ratio = input("Enter slit:stem ratio 1:");
>     else:
>         w_stem_ratio = 1;
>     print "slit:stem = 1:",w_stem_ratio;
> 
> spacing = focal_length/BAHTINOV_FACTOR;
> if ( w_stem_ratio == 0 ):
>     if ( spacing - tri_stem_w > tri_stem_w * 0.5 ) :
>         tri_w = spacing - tri_stem_w
>     else:
>         tri_w = spacing / 3;
>         tri_stem_w = 2 * spacing / 3;
> else:
>     tri_w = spacing / ( w_stem_ratio + 1 );
>     tri_stem_w = w_stem_ratio * spacing / ( w_stem_ratio + 1 );
584c606
< tri_in_r = tri_inb_r + tri_stem_w;
---
> tri_in_r = tri_inb_r + tri_in_w;
cytan299 commented 7 years ago

Hi Satoru   Great job! I like it!    I'll update the github distribution and credit you for the changes. I'll do it this weekend in case you have other improvements. cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: cytan299 cytan299@yahoo.com; Comment comment@noreply.github.com Sent: Thursday, June 22, 2017 12:53 PM Subject: Re: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

Hi, cytan, In astrojargon, the width of slit and uncut space can always be set equal only, whereas patched generate.py and its webApps version have a richer function that can specify the width ratio. On the other hand, I think that it would be preferable to be able to set the width of the "inner support" which is the stem between the center hole and the slits independently, considering the mechanical strength. And I think that it is appropriate that the value is about 0.2362 inch. The draft of the patch is as follows.94a95

tri_in_w = 0.2362*INCH2PIXELS; # inches, width of the inner support 567c568,589 < tri_w = focal_length/BAHTINOV_FACTOR;

fixed_stem = raw_input("Do you use fixed stem width? (y/N):"); if ( fixed_stem == "y" ) : w_stem_ratio = 0; print "fixed stem width:",tri_stem_w/INCH2PIXELS,"in"; else: set_stem_ratio = raw_input("Do you set slit:stem ratio? (y/N):"); if ( set_stem_ratio == "y" ) : w_stem_ratio = input("Enter slit:stem ratio 1:"); else: w_stem_ratio = 1; print "slit:stem = 1:",w_stem_ratio;

spacing = focal_length/BAHTINOV_FACTOR; if ( w_stem_ratio == 0 ): if ( spacing - tri_stem_w > tri_stem_w 0.5 ) : tri_w = spacing - tri_stem_w else: tri_w = spacing / 3; tri_stem_w = 2 spacing / 3; else: tri_w = spacing / ( w_stem_ratio + 1 ); tri_stem_w = w_stem_ratio * spacing / ( w_stem_ratio + 1 ); 584c606 < tri_in_r = tri_inb_r + tri_stem_w;

tri_in_r = tri_inb_r + tri_in_w; — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

cytan299 commented 7 years ago

Hi Satoru,   I've updated the github site to acknowledge your contribution to generate.py in both README.md and the generate.py source code. See if you like it.  cytan

  From: Satoru Takagi <notifications@github.com>

To: cytan299/tribahtinov tribahtinov@noreply.github.com Cc: cytan299 cytan299@yahoo.com; Comment comment@noreply.github.com Sent: Thursday, June 22, 2017 12:53 PM Subject: Re: [cytan299/tribahtinov] The pitch of the diffraction grating becomes thick (#4)

Hi, cytan, In astrojargon, the width of slit and uncut space can always be set equal only, whereas patched generate.py and its webApps version have a richer function that can specify the width ratio. On the other hand, I think that it would be preferable to be able to set the width of the "inner support" which is the stem between the center hole and the slits independently, considering the mechanical strength. And I think that it is appropriate that the value is about 0.2362 inch. The draft of the patch is as follows.94a95

tri_in_w = 0.2362*INCH2PIXELS; # inches, width of the inner support 567c568,589 < tri_w = focal_length/BAHTINOV_FACTOR;

fixed_stem = raw_input("Do you use fixed stem width? (y/N):"); if ( fixed_stem == "y" ) : w_stem_ratio = 0; print "fixed stem width:",tri_stem_w/INCH2PIXELS,"in"; else: set_stem_ratio = raw_input("Do you set slit:stem ratio? (y/N):"); if ( set_stem_ratio == "y" ) : w_stem_ratio = input("Enter slit:stem ratio 1:"); else: w_stem_ratio = 1; print "slit:stem = 1:",w_stem_ratio;

spacing = focal_length/BAHTINOV_FACTOR; if ( w_stem_ratio == 0 ): if ( spacing - tri_stem_w > tri_stem_w 0.5 ) : tri_w = spacing - tri_stem_w else: tri_w = spacing / 3; tri_stem_w = 2 spacing / 3; else: tri_w = spacing / ( w_stem_ratio + 1 ); tri_stem_w = w_stem_ratio * spacing / ( w_stem_ratio + 1 ); 584c606 < tri_in_r = tri_inb_r + tri_stem_w;

tri_in_r = tri_inb_r + tri_in_w; — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

satakagi commented 7 years ago

Thank you for your good work. I am porting a routine implemented in webApps to generate.py to determine a split point so that the area of the slots of right up and right down are equal. It takes a bit of time, but I will report it as a new issue or pull request once it is completed.